[ACPICA]
[reactos.git] / reactos / drivers / bus / acpi / acpica / include / platform / acmsvc.h
index 9147fd7..db302ad 100644 (file)
  * out if these are actually defined.
  */
 
-/*
- * Map low I/O functions for MS. This allows us to disable MS language
- * extensions for maximum portability.
- */
-#define open            _open
-#define read            _read
-#define write           _write
-#define close           _close
-#define stat            _stat
-#define fstat           _fstat
-#define mkdir           _mkdir
-#define snprintf        _snprintf
-#if _MSC_VER <= 1200 /* Versions below VC++ 6 */
-#define vsnprintf       _vsnprintf
-#endif
-#define O_RDONLY        _O_RDONLY
-#define O_BINARY        _O_BINARY
-#define O_CREAT         _O_CREAT
-#define O_WRONLY        _O_WRONLY
-#define O_TRUNC         _O_TRUNC
-#define S_IREAD         _S_IREAD
-#define S_IWRITE        _S_IWRITE
-#define S_IFDIR         _S_IFDIR
-
 /* Eliminate warnings for "old" (non-secure) versions of clib functions */
 
 #ifndef _CRT_SECURE_NO_WARNINGS
 
 /* Do not maintain the architecture specific stuffs for the EFI ports */
 
-#if !defined(_EDK2_EFI) && !defined(_GNU_EFI)
-#ifndef _LINT
+#if defined(__i386__) && !defined(_GNU_EFI) && !defined(_EDK2_EFI)
 /*
  * Math helper functions
  */
+#ifndef ACPI_DIV_64_BY_32
 #define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
 {                           \
     __asm mov    edx, n_hi  \
     __asm mov    q32, eax   \
     __asm mov    r32, edx   \
 }
+#endif
 
-#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
+#ifndef ACPI_MUL_64_BY_32
+#define ACPI_MUL_64_BY_32(n_hi, n_lo, m32, p32, c32) \
 {                           \
-    __asm shr    n_hi, 1    \
-    __asm rcr    n_lo, 1    \
+    __asm mov    edx, n_hi  \
+    __asm mov    eax, n_lo  \
+    __asm mul    m32        \
+    __asm mov    p32, eax   \
+    __asm mov    c32, edx   \
 }
-#else
+#endif
 
-/* Fake versions to make lint happy */
+#ifndef ACPI_SHIFT_LEFT_64_BY_32
+#define ACPI_SHIFT_LEFT_64_BY_32(n_hi, n_lo, s32) \
+{                               \
+    __asm mov    edx, n_hi      \
+    __asm mov    eax, n_lo      \
+    __asm mov    ecx, s32       \
+    __asm and    ecx, 31        \
+    __asm shld   edx, eax, cl   \
+    __asm shl    eax, cl        \
+    __asm mov    n_hi, edx      \
+    __asm mov    n_lo, eax      \
+}
+#endif
 
-#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \
-{                           \
-    q32 = n_hi / d32;       \
-    r32 = n_lo / d32;       \
+#ifndef ACPI_SHIFT_RIGHT_64_BY_32
+#define ACPI_SHIFT_RIGHT_64_BY_32(n_hi, n_lo, s32) \
+{                               \
+    __asm mov    edx, n_hi      \
+    __asm mov    eax, n_lo      \
+    __asm mov    ecx, s32       \
+    __asm and    ecx, 31        \
+    __asm shrd   eax, edx, cl   \
+    __asm shr    edx, cl        \
+    __asm mov    n_hi, edx      \
+    __asm mov    n_lo, eax      \
 }
+#endif
 
+#ifndef ACPI_SHIFT_RIGHT_64
 #define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \
 {                           \
-    n_hi >>= 1;    \
-    n_lo >>= 1;    \
+    __asm shr    n_hi, 1    \
+    __asm rcr    n_lo, 1    \
 }
 #endif
 #endif