/* 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
+EXTERN _KeGetCurrentIrql@0:PROC
+EXTERN _KeBugCheckEx@20: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 */
lea eax, [eax+KTRAP_FRAME_ESP]
ret
-.endfunc
/*++
- * @name KiCallUserMode
+ * @name KiCallUserMode
*
* The KiSwitchToUserMode routine sets up a Trap Frame and a Callback stack
* for the purpose of switching to user mode. The actual final jump is done
* This call MUST be paired by interrupt 0x2B or NtCallbackReturn.
*
*--*/
-.globl _KiCallUserMode@8
-.func KiCallUserMode@8
+PUBLIC _KiCallUserMode@8
_KiCallUserMode@8:
/* Save volatile registers */
#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
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 */
/* 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 */
/* Return */
ret 8
-.endfunc
/*++
* @name NtCallbackReturn
* @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 */
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:
/* Return failure */
mov eax, STATUS_NO_CALLBACK_ACTIVE
ret 12
-.endfunc
/*++
- * @name KeSwitchKernelStack
+ * @name KeSwitchKernelStack
*
* The KeSwitchKernelStack routine switches from the current thread's stack
* to the new specified base and limit.
*
* @return The previous Stack Base of the thread.
*
- * @remark This routine should typically only be used when converting from a
+ * @remark This routine should typically only be used when converting from a
* non-GUI to a GUI Thread. The caller is responsible for freeing the
* previous stack. The new stack values MUST be valid before calling
* this routine.
*
*--*/
-.globl _KeSwitchKernelStack@8
-.func KeSwitchKernelStack@8
+PUBLIC _KeSwitchKernelStack@8
_KeSwitchKernelStack@8:
/* Save volatiles */
pop edi
pop esi
ret 8
-.endfunc
+
+END