[vbox-dev] [PATCH 3/3] VBoxGuest.h: Use separate ioctl numbers for 32 and 64 bit HGCM calls

Hans de Goede hdegoede at redhat.com
Wed Aug 16 09:54:56 GMT 2017


This makes the ioctl interface mirror the vmmdev-reqs more closely,
the vmmdev-reqs have separate codes for this to:

    VMMDevReq_HGCMCall32                 = 62,
    VMMDevReq_HGCMCall64                 = 63,

This also allows us to remove the VBOXGUEST_IOCTL_FLAG and consistently
use VBOXGUEST_IOCTL_CODE_ directly for all ioctls.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 include/VBox/VBoxGuest.h | 50 ++++++++++++++++--------------------------------
 1 file changed, 17 insertions(+), 33 deletions(-)

diff --git a/include/VBox/VBoxGuest.h b/include/VBox/VBoxGuest.h
index b2650bf8..6f9d5c32 100644
--- a/include/VBox/VBoxGuest.h
+++ b/include/VBox/VBoxGuest.h
@@ -98,9 +98,7 @@
  * The range 16..31 is for HGCM communication.
  * The range 32..47 is reserved for future use.
  * The range 48..63 is for OS specific communication.
- * The 7th bit is reserved for future hacks.
- * The 8th bit is reserved for distinguishing between 32-bit and 64-bit
- * processes in future 64-bit guest additions.
+ * The 7th and 8 bits are reserved for future hacks.
  *
  * @remarks When creating new IOCtl interfaces keep in mind that not all OSes supports
  *          reporting back the output size. (This got messed up a little bit in VBoxDrv.)
@@ -121,16 +119,7 @@
  * @remarks If adding interfaces that only has input or only has output, some new macros
  *          needs to be created so the most efficient IOCtl data buffering method can be
  *          used.
- * @{
  */
-#if defined(RT_ARCH_AMD64) || defined(RT_ARCH_SPARC64)
-# define VBOXGUEST_IOCTL_FLAG     128
-#elif defined(RT_ARCH_X86) || defined(RT_ARCH_SPARC)
-# define VBOXGUEST_IOCTL_FLAG     0
-#else
-# error "dunno which arch this is!"
-#endif
-/** @} */
 
 /** Ring-3 request wrapper for big requests.
  *
@@ -212,16 +201,6 @@ typedef const VBGLBIGREQ *PCVBGLBIGREQ;
 # define VBOXGUEST_IOCTL_STRIP_SIZE(uIOCtl)         ( (uIOCtl) & ~_IOC(0,0,0,IOCPARM_MASK) )
 #endif
 
-#define VBOXGUEST_IOCTL_CODE(Function, Size)        VBOXGUEST_IOCTL_CODE_((Function) | VBOXGUEST_IOCTL_FLAG, Size)
-#define VBOXGUEST_IOCTL_CODE_FAST(Function)         VBOXGUEST_IOCTL_CODE_FAST_((Function) | VBOXGUEST_IOCTL_FLAG)
-
-/* Define 32 bit codes to support 32 bit applications requests in the 64 bit guest driver. */
-#ifdef RT_ARCH_AMD64
-# define VBOXGUEST_IOCTL_CODE_32(Function, Size)    VBOXGUEST_IOCTL_CODE_(Function, Size)
-# define VBOXGUEST_IOCTL_CODE_FAST_32(Function)     VBOXGUEST_IOCTL_CODE_FAST_(Function)
-#endif /* RT_ARCH_AMD64 */
-
-
 
 /** IOCTL to VBoxGuest to query the VMMDev IO port region start.
  * @remarks Ring-0 only. */
@@ -355,26 +334,31 @@ AssertCompileSize(VBoxGuestWriteCoreDump, 4);
 /** IOCTL to VBoxGuest to disconnect from a HGCM service. */
 # define VBOXGUEST_IOCTL_HGCM_DISCONNECT            VBOXGUEST_IOCTL_CODE_(17, sizeof(VBoxGuestHGCMDisconnectInfo))
 
-/** IOCTL to VBoxGuest to make a call to a HGCM service.
+/** IOCTL to VBoxGuest for 32-bit clients to make a call to a HGCM service.
+ * On 64-bit guests these are used by the Windows OpenGL guest driver.
  * @see VBoxGuestHGCMCallInfo */
-# define VBOXGUEST_IOCTL_HGCM_CALL(Size)            VBOXGUEST_IOCTL_CODE(18, (Size))
+# define VBOXGUEST_IOCTL_HGCM_CALL_32(Size)         VBOXGUEST_IOCTL_CODE_(18, (Size))
 
-/** IOCTL to VBoxGuest to make a timed call to a HGCM service. */
-# define VBOXGUEST_IOCTL_HGCM_CALL_TIMED(Size)      VBOXGUEST_IOCTL_CODE(20, (Size))
+/** IOCTL to VBoxGuest for 32-bit clients to make a timed call to a HGCM service. */
+# define VBOXGUEST_IOCTL_HGCM_CALL_TIMED_32(Size)   VBOXGUEST_IOCTL_CODE_(20, (Size))
 
 /** IOCTL to VBoxGuest passed from the Kernel Mode driver, but containing a user mode data in VBoxGuestHGCMCallInfo
  * the driver received from the UM. Called in the context of the process passing the data.
  * @see VBoxGuestHGCMCallInfo */
 # define VBOXGUEST_IOCTL_HGCM_CALL_USERDATA(Size)   VBOXGUEST_IOCTL_CODE_(21, (Size))
 
+/** IOCTL to VBoxGuest for 64-bit clients to make a call to a HGCM service. */
+# define VBOXGUEST_IOCTL_HGCM_CALL_64(Size)         VBOXGUEST_IOCTL_CODE_(22, (Size))
+
+/** IOCTL to VBoxGuest for 64-bit clients to make a timed call to a HGCM service. */
+# define VBOXGUEST_IOCTL_HGCM_CALL_TIMED_64(Size)   VBOXGUEST_IOCTL_CODE_(23, (Size))
+
 # 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!
- * @{*/
-#  define VBOXGUEST_IOCTL_HGCM_CALL_32(Size)        VBOXGUEST_IOCTL_CODE_32(18, (Size))
-#  define VBOXGUEST_IOCTL_HGCM_CALL_TIMED_32(Size)  VBOXGUEST_IOCTL_CODE_32(20, (Size))
-/** @} */
+#  define VBOXGUEST_IOCTL_HGCM_CALL(Size)        VBOXGUEST_IOCTL_HGCM_CALL_64(Size)
+#  define VBOXGUEST_IOCTL_HGCM_CALL_TIMED(Size)  VBOXGUEST_IOCTL_HGCM_CALL_TIMED_64(Size)
+#else
+#  define VBOXGUEST_IOCTL_HGCM_CALL(Size)        VBOXGUEST_IOCTL_HGCM_CALL_32(Size)
+#  define VBOXGUEST_IOCTL_HGCM_CALL_TIMED(Size)  VBOXGUEST_IOCTL_HGCM_CALL_TIMED_32(Size)
 # endif /* RT_ARCH_AMD64 */
 
 /** Get the pointer to the first HGCM parameter.  */
-- 
2.13.4




More information about the vbox-dev mailing list