- Update to trunk
[reactos.git] / ntoskrnl / ke / i386 / usercall_asm.S
index 2da7268..dcdc7ba 100644 (file)
@@ -8,17 +8,18 @@
 
 /* INCLUDES ******************************************************************/
 
-#include <reactos/asm.h>
-#include <ndk/i386/asm.h>
+#include <asm.inc>
+#include <ks386.inc>
 #include <internal/i386/asmmacro.S>
 
-/* FUNCTIONS ****************************************************************/
+EXTERN _MmGrowKernelStack@4:PROC
+EXTERN _KeUserCallbackDispatcher:PROC
+EXTERN @KiServiceExit@8:PROC
 
-.code32
-.text
+/* FUNCTIONS ****************************************************************/
+.code
 
-.globl _KiGetUserModeStackAddress@0
-.func KiGetUserModeStackAddress@0
+PUBLIC _KiGetUserModeStackAddress@0
 _KiGetUserModeStackAddress@0:
 
     /* Get the current thread's trapframe and return the esp */
@@ -27,7 +28,6 @@ _KiGetUserModeStackAddress@0:
     lea eax, [eax+KTRAP_FRAME_ESP]
     ret
 
-.endfunc
 
 /*++
  * @name KiCallUserMode 
@@ -53,8 +53,7 @@ _KiGetUserModeStackAddress@0:
  *         This call MUST be paired by interrupt 0x2B or NtCallbackReturn.
  *
  *--*/
-.globl _KiCallUserMode@8
-.func KiCallUserMode@8
+PUBLIC _KiCallUserMode@8
 _KiCallUserMode@8:
 
     /* Save volatile registers */
@@ -102,7 +101,7 @@ ApcsEnabled:
 #endif
 
     /* Get the lowest stack limit and check if we can handle it */
-    lea eax, [esp-0x3000]
+    lea eax, [esp-HEX(3000)]
     cmp eax, [ebx+KTHREAD_STACK_LIMIT]
     jnb StackOk
 
@@ -130,7 +129,7 @@ StackOk:
     mov [ebx+KTHREAD_CALLBACK_STACK], esp
 
     /* Align stack on 16-byte boundary */
-    and esp, ~15
+    and esp, NOT 15
     mov edi, esp
 
     /* Set destination and origin NPX Areas */
@@ -181,7 +180,7 @@ DontBias:
 
     /* Copy DR7 */
     mov edi, [edx+KTRAP_FRAME_DR7]
-    test edi, ~DR7_RESERVED_MASK
+    test edi, NOT DR7_RESERVED_MASK
     mov [esp+KTRAP_FRAME_DR7], edi
 
     /* Check if we need to save debug registers */
@@ -226,7 +225,6 @@ GrowFailed:
     /* Return */
     ret 8
 
-.endfunc
 
 /*++
  * @name NtCallbackReturn
@@ -251,8 +249,7 @@ GrowFailed:
  * @remark This call MUST be paired with KeUserModeCallback.
  *
  *--*/
-.globl _NtCallbackReturn@12
-.func NtCallbackReturn@12
+PUBLIC _NtCallbackReturn@12
 _NtCallbackReturn@12:
 
     /* Get the current thread and make sure we have a callback stack */
@@ -316,7 +313,7 @@ CheckDebug:
     and dword ptr [edi+KTRAP_FRAME_DR7], 0
 
     /* Check if debugging was active */
-    test byte ptr [eax+KTHREAD_DEBUG_ACTIVE], 0xFF
+    test byte ptr [eax+KTHREAD_DEBUG_ACTIVE], HEX(0FF)
     jnz RestoreDebug
 
 RestoreStack:
@@ -407,7 +404,6 @@ NoStack:
     /* Return failure */
     mov eax, STATUS_NO_CALLBACK_ACTIVE
     ret 12
-.endfunc
 
 /*++
  * @name KeSwitchKernelStack 
@@ -429,8 +425,7 @@ NoStack:
  *         this routine.
  *
  *--*/
-.globl _KeSwitchKernelStack@8
-.func KeSwitchKernelStack@8
+PUBLIC _KeSwitchKernelStack@8
 _KeSwitchKernelStack@8:
 
     /* Save volatiles */
@@ -515,4 +510,5 @@ V86Switch:
     pop edi
     pop esi
     ret 8
-.endfunc
+
+END