Index: /trunk/include/iprt/asm-amd64-x86.h
===================================================================
--- /trunk/include/iprt/asm-amd64-x86.h	(revision 58704)
+++ /trunk/include/iprt/asm-amd64-x86.h	(revision 58705)
@@ -93,5 +93,9 @@
     uint16_t    cbIdt;
     /** Address of the IDT. */
-    uintptr_t   pIdt;
+#if ARCH_BITS != 64
+    uint32_t    pIdt;
+#else
+    uint64_t    pIdt;
+#endif
 } RTIDTR, *PRTIDTR;
 #pragma pack()
@@ -102,5 +106,5 @@
 {
     /** Alignment padding.   */
-    uint8_t     au16Padding[ARCH_BITS == 64 ? 3 : 1];
+    uint16_t    au16Padding[ARCH_BITS == 64 ? 3 : 1];
     /** The IDTR structure.  */
     RTIDTR      Idtr;
@@ -116,5 +120,5 @@
     RTIDTRALIGNEDINT    s;
 } RTIDTRALIGNED;
-AssertCompileSize(RTIDTRALIGNED, ARCH_BITS * 2 / 8);
+AssertCompileSize(RTIDTRALIGNED, ((ARCH_BITS == 64) + 1) * 8);
 /** Pointer to a an RTIDTR alignment wrapper. */
 typedef RTIDTRALIGNED *PRIDTRALIGNED;
@@ -128,5 +132,9 @@
     uint16_t    cbGdt;
     /** Address of the GDT. */
-    uintptr_t   pGdt;
+#if ARCH_BITS != 64
+    uint32_t    pGdt;
+#else
+    uint64_t    pGdt;
+#endif
 } RTGDTR, *PRTGDTR;
 #pragma pack()
@@ -137,5 +145,5 @@
 {
     /** Alignment padding.   */
-    uint8_t     au16Padding[ARCH_BITS == 64 ? 3 : 1];
+    uint16_t    au16Padding[ARCH_BITS == 64 ? 3 : 1];
     /** The GDTR structure.  */
     RTGDTR      Gdtr;
@@ -151,5 +159,5 @@
     RTGDTRALIGNEDINT    s;
 } RTGDTRALIGNED;
-AssertCompileSize(RTGDTRALIGNED, ARCH_BITS * 2 / 8);
+AssertCompileSize(RTIDTRALIGNED, ((ARCH_BITS == 64) + 1) * 8);
 /** Pointer to a an RTGDTR alignment wrapper. */
 typedef RTGDTRALIGNED *PRGDTRALIGNED;
@@ -1553,9 +1561,9 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(RTCCUINTREG) ASMGetCR0(void);
-#else
-DECLINLINE(RTCCUINTREG) ASMGetCR0(void)
-{
-    RTCCUINTREG uCR0;
+DECLASM(RTCCUINTXREG) ASMGetCR0(void);
+#else
+DECLINLINE(RTCCUINTXREG) ASMGetCR0(void)
+{
+    RTCCUINTXREG uCR0;
 # if RT_INLINE_ASM_USES_INTRIN
     uCR0 = __readcr0();
@@ -1589,7 +1597,7 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(void) ASMSetCR0(RTCCUINTREG uCR0);
-#else
-DECLINLINE(void) ASMSetCR0(RTCCUINTREG uCR0)
+DECLASM(void) ASMSetCR0(RTCCUINTXREG uCR0);
+#else
+DECLINLINE(void) ASMSetCR0(RTCCUINTXREG uCR0)
 {
 # if RT_INLINE_ASM_USES_INTRIN
@@ -1623,9 +1631,9 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(RTCCUINTREG) ASMGetCR2(void);
-#else
-DECLINLINE(RTCCUINTREG) ASMGetCR2(void)
-{
-    RTCCUINTREG uCR2;
+DECLASM(RTCCUINTXREG) ASMGetCR2(void);
+#else
+DECLINLINE(RTCCUINTXREG) ASMGetCR2(void)
+{
+    RTCCUINTXREG uCR2;
 # if RT_INLINE_ASM_USES_INTRIN
     uCR2 = __readcr2();
@@ -1659,7 +1667,7 @@
  */
 #if RT_INLINE_ASM_EXTERNAL
-DECLASM(void) ASMSetCR2(RTCCUINTREG uCR2);
-#else
-DECLINLINE(void) ASMSetCR2(RTCCUINTREG uCR2)
+DECLASM(void) ASMSetCR2(RTCCUINTXREG uCR2);
+#else
+DECLINLINE(void) ASMSetCR2(RTCCUINTXREG uCR2)
 {
 # if RT_INLINE_ASM_GNU_STYLE
@@ -1690,9 +1698,9 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(RTCCUINTREG) ASMGetCR3(void);
-#else
-DECLINLINE(RTCCUINTREG) ASMGetCR3(void)
-{
-    RTCCUINTREG uCR3;
+DECLASM(RTCCUINTXREG) ASMGetCR3(void);
+#else
+DECLINLINE(RTCCUINTXREG) ASMGetCR3(void)
+{
+    RTCCUINTXREG uCR3;
 # if RT_INLINE_ASM_USES_INTRIN
     uCR3 = __readcr3();
@@ -1727,7 +1735,7 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(void) ASMSetCR3(RTCCUINTREG uCR3);
-#else
-DECLINLINE(void) ASMSetCR3(RTCCUINTREG uCR3)
+DECLASM(void) ASMSetCR3(RTCCUINTXREG uCR3);
+#else
+DECLINLINE(void) ASMSetCR3(RTCCUINTXREG uCR3)
 {
 # if RT_INLINE_ASM_USES_INTRIN
@@ -1768,5 +1776,5 @@
 
 # elif RT_INLINE_ASM_GNU_STYLE
-    RTCCUINTREG u;
+    RTCCUINTXREG u;
 #  ifdef RT_ARCH_AMD64
     __asm__ __volatile__("movq %%cr3, %0\n\t"
@@ -1799,9 +1807,9 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(RTCCUINTREG) ASMGetCR4(void);
-#else
-DECLINLINE(RTCCUINTREG) ASMGetCR4(void)
-{
-    RTCCUINTREG uCR4;
+DECLASM(RTCCUINTXREG) ASMGetCR4(void);
+#else
+DECLINLINE(RTCCUINTXREG) ASMGetCR4(void)
+{
+    RTCCUINTXREG uCR4;
 # if RT_INLINE_ASM_USES_INTRIN
     uCR4 = __readcr4();
@@ -1841,7 +1849,7 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(void) ASMSetCR4(RTCCUINTREG uCR4);
-#else
-DECLINLINE(void) ASMSetCR4(RTCCUINTREG uCR4)
+DECLASM(void) ASMSetCR4(RTCCUINTXREG uCR4);
+#else
+DECLINLINE(void) ASMSetCR4(RTCCUINTXREG uCR4)
 {
 # if RT_INLINE_ASM_USES_INTRIN
@@ -1878,10 +1886,10 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(RTCCUINTREG) ASMGetCR8(void);
-#else
-DECLINLINE(RTCCUINTREG) ASMGetCR8(void)
+DECLASM(RTCCUINTXREG) ASMGetCR8(void);
+#else
+DECLINLINE(RTCCUINTXREG) ASMGetCR8(void)
 {
 # ifdef RT_ARCH_AMD64
-    RTCCUINTREG uCR8;
+    RTCCUINTXREG uCR8;
 #  if RT_INLINE_ASM_USES_INTRIN
     uCR8 = __readcr8();
@@ -2118,7 +2126,7 @@
  */
 #if RT_INLINE_ASM_EXTERNAL
-DECLASM(uint64_t) ASMRdMsrEx(uint32_t uRegister, RTCCUINTREG uXDI);
-#else
-DECLINLINE(uint64_t) ASMRdMsrEx(uint32_t uRegister, RTCCUINTREG uXDI)
+DECLASM(uint64_t) ASMRdMsrEx(uint32_t uRegister, RTCCUINTXREG uXDI);
+#else
+DECLINLINE(uint64_t) ASMRdMsrEx(uint32_t uRegister, RTCCUINTXREG uXDI)
 {
     RTUINT64U u;
@@ -2156,7 +2164,7 @@
  */
 #if RT_INLINE_ASM_EXTERNAL
-DECLASM(void) ASMWrMsrEx(uint32_t uRegister, RTCCUINTREG uXDI, uint64_t u64Val);
-#else
-DECLINLINE(void) ASMWrMsrEx(uint32_t uRegister, RTCCUINTREG uXDI, uint64_t u64Val)
+DECLASM(void) ASMWrMsrEx(uint32_t uRegister, RTCCUINTXREG uXDI, uint64_t u64Val);
+#else
+DECLINLINE(void) ASMWrMsrEx(uint32_t uRegister, RTCCUINTXREG uXDI, uint64_t u64Val)
 {
     RTUINT64U u;
@@ -2262,9 +2270,9 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(RTCCUINTREG) ASMGetDR0(void);
-#else
-DECLINLINE(RTCCUINTREG) ASMGetDR0(void)
-{
-    RTCCUINTREG uDR0;
+DECLASM(RTCCUINTXREG) ASMGetDR0(void);
+#else
+DECLINLINE(RTCCUINTXREG) ASMGetDR0(void)
+{
+    RTCCUINTXREG uDR0;
 # if RT_INLINE_ASM_USES_INTRIN
     uDR0 = __readdr(0);
@@ -2298,9 +2306,9 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(RTCCUINTREG) ASMGetDR1(void);
-#else
-DECLINLINE(RTCCUINTREG) ASMGetDR1(void)
-{
-    RTCCUINTREG uDR1;
+DECLASM(RTCCUINTXREG) ASMGetDR1(void);
+#else
+DECLINLINE(RTCCUINTXREG) ASMGetDR1(void)
+{
+    RTCCUINTXREG uDR1;
 # if RT_INLINE_ASM_USES_INTRIN
     uDR1 = __readdr(1);
@@ -2334,9 +2342,9 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(RTCCUINTREG) ASMGetDR2(void);
-#else
-DECLINLINE(RTCCUINTREG) ASMGetDR2(void)
-{
-    RTCCUINTREG uDR2;
+DECLASM(RTCCUINTXREG) ASMGetDR2(void);
+#else
+DECLINLINE(RTCCUINTXREG) ASMGetDR2(void)
+{
+    RTCCUINTXREG uDR2;
 # if RT_INLINE_ASM_USES_INTRIN
     uDR2 = __readdr(2);
@@ -2370,9 +2378,9 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(RTCCUINTREG) ASMGetDR3(void);
-#else
-DECLINLINE(RTCCUINTREG) ASMGetDR3(void)
-{
-    RTCCUINTREG uDR3;
+DECLASM(RTCCUINTXREG) ASMGetDR3(void);
+#else
+DECLINLINE(RTCCUINTXREG) ASMGetDR3(void)
+{
+    RTCCUINTXREG uDR3;
 # if RT_INLINE_ASM_USES_INTRIN
     uDR3 = __readdr(3);
@@ -2406,9 +2414,9 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(RTCCUINTREG) ASMGetDR6(void);
-#else
-DECLINLINE(RTCCUINTREG) ASMGetDR6(void)
-{
-    RTCCUINTREG uDR6;
+DECLASM(RTCCUINTXREG) ASMGetDR6(void);
+#else
+DECLINLINE(RTCCUINTXREG) ASMGetDR6(void)
+{
+    RTCCUINTXREG uDR6;
 # if RT_INLINE_ASM_USES_INTRIN
     uDR6 = __readdr(6);
@@ -2442,14 +2450,14 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(RTCCUINTREG) ASMGetAndClearDR6(void);
-#else
-DECLINLINE(RTCCUINTREG) ASMGetAndClearDR6(void)
-{
-    RTCCUINTREG uDR6;
+DECLASM(RTCCUINTXREG) ASMGetAndClearDR6(void);
+#else
+DECLINLINE(RTCCUINTXREG) ASMGetAndClearDR6(void)
+{
+    RTCCUINTXREG uDR6;
 # if RT_INLINE_ASM_USES_INTRIN
     uDR6 = __readdr(6);
     __writedr(6, 0xffff0ff0U);          /* 31-16 and 4-11 are 1's, 12 and 63-31 are zero. */
 # elif RT_INLINE_ASM_GNU_STYLE
-    RTCCUINTREG uNewValue = 0xffff0ff0U;/* 31-16 and 4-11 are 1's, 12 and 63-31 are zero. */
+    RTCCUINTXREG uNewValue = 0xffff0ff0U;/* 31-16 and 4-11 are 1's, 12 and 63-31 are zero. */
 #  ifdef RT_ARCH_AMD64
     __asm__ __volatile__("movq   %%dr6, %0\n\t"
@@ -2491,9 +2499,9 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(RTCCUINTREG) ASMGetDR7(void);
-#else
-DECLINLINE(RTCCUINTREG) ASMGetDR7(void)
-{
-    RTCCUINTREG uDR7;
+DECLASM(RTCCUINTXREG) ASMGetDR7(void);
+#else
+DECLINLINE(RTCCUINTXREG) ASMGetDR7(void)
+{
+    RTCCUINTXREG uDR7;
 # if RT_INLINE_ASM_USES_INTRIN
     uDR7 = __readdr(7);
@@ -2527,7 +2535,7 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(void) ASMSetDR0(RTCCUINTREG uDRVal);
-#else
-DECLINLINE(void) ASMSetDR0(RTCCUINTREG uDRVal)
+DECLASM(void) ASMSetDR0(RTCCUINTXREG uDRVal);
+#else
+DECLINLINE(void) ASMSetDR0(RTCCUINTXREG uDRVal)
 {
 # if RT_INLINE_ASM_USES_INTRIN
@@ -2561,7 +2569,7 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(void) ASMSetDR1(RTCCUINTREG uDRVal);
-#else
-DECLINLINE(void) ASMSetDR1(RTCCUINTREG uDRVal)
+DECLASM(void) ASMSetDR1(RTCCUINTXREG uDRVal);
+#else
+DECLINLINE(void) ASMSetDR1(RTCCUINTXREG uDRVal)
 {
 # if RT_INLINE_ASM_USES_INTRIN
@@ -2595,7 +2603,7 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(void) ASMSetDR2(RTCCUINTREG uDRVal);
-#else
-DECLINLINE(void) ASMSetDR2(RTCCUINTREG uDRVal)
+DECLASM(void) ASMSetDR2(RTCCUINTXREG uDRVal);
+#else
+DECLINLINE(void) ASMSetDR2(RTCCUINTXREG uDRVal)
 {
 # if RT_INLINE_ASM_USES_INTRIN
@@ -2629,7 +2637,7 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(void) ASMSetDR3(RTCCUINTREG uDRVal);
-#else
-DECLINLINE(void) ASMSetDR3(RTCCUINTREG uDRVal)
+DECLASM(void) ASMSetDR3(RTCCUINTXREG uDRVal);
+#else
+DECLINLINE(void) ASMSetDR3(RTCCUINTXREG uDRVal)
 {
 # if RT_INLINE_ASM_USES_INTRIN
@@ -2663,7 +2671,7 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(void) ASMSetDR6(RTCCUINTREG uDRVal);
-#else
-DECLINLINE(void) ASMSetDR6(RTCCUINTREG uDRVal)
+DECLASM(void) ASMSetDR6(RTCCUINTXREG uDRVal);
+#else
+DECLINLINE(void) ASMSetDR6(RTCCUINTXREG uDRVal)
 {
 # if RT_INLINE_ASM_USES_INTRIN
@@ -2697,7 +2705,7 @@
  */
 #if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
-DECLASM(void) ASMSetDR7(RTCCUINTREG uDRVal);
-#else
-DECLINLINE(void) ASMSetDR7(RTCCUINTREG uDRVal)
+DECLASM(void) ASMSetDR7(RTCCUINTXREG uDRVal);
+#else
+DECLINLINE(void) ASMSetDR7(RTCCUINTXREG uDRVal)
 {
 # if RT_INLINE_ASM_USES_INTRIN
@@ -3314,4 +3322,10 @@
 #endif /* !_MSC_VER) || !RT_ARCH_AMD64 */
 
+#if defined(__WATCOMC__) && ARCH_BITS == 16
+# include "asm-amd64-x86-watcom-16.h"
+#elif defined(__WATCOMC__) && ARCH_BITS == 32
+# include "asm-amd64-x86-watcom-32.h"
+#endif
+
 /** @} */
 #endif
