mirror of
https://github.com/reactos/reactos.git
synced 2025-02-21 16:04:57 +00:00
[ASM x64] Change ; by /* */ for comments
Syntax with semi-colon is not supported by gas.
This commit is contained in:
parent
4bb7bd1f50
commit
ff7035d940
6 changed files with 101 additions and 98 deletions
|
@ -62,44 +62,44 @@ PUBLIC KiRaiseUserExceptionDispatcher
|
|||
PUBLIC KiUserCallbackDispatcher
|
||||
.PROC KiUserCallbackDispatcher
|
||||
|
||||
; The stack is set up with a UCALLOUT_FRAME
|
||||
; The frame ends with a MACHINE_FRAME.
|
||||
/* The stack is set up with a UCALLOUT_FRAME */
|
||||
/* The frame ends with a MACHINE_FRAME. */
|
||||
.PUSHFRAME
|
||||
|
||||
; This is for the Home space, Buffer, Length and ApiNumber
|
||||
/* This is for the Home space, Buffer, Length and ApiNumber */
|
||||
.ALLOCSTACK 6 * 8
|
||||
.ENDPROLOG
|
||||
|
||||
#if DBG
|
||||
; We enter the function with a fully setup stack, so it must be aligned!
|
||||
/* We enter the function with a fully setup stack, so it must be aligned! */
|
||||
test rsp, 15
|
||||
jz AlignmentOk
|
||||
int HEX(2C)
|
||||
AlignmentOk:
|
||||
#endif
|
||||
|
||||
; Get the parameters from the callout frame
|
||||
/* Get the parameters from the callout frame */
|
||||
mov rcx, [rsp + CkBuffer]
|
||||
mov edx, [rsp + CkLength]
|
||||
mov r8d, [rsp + CkApiNumber]
|
||||
|
||||
; Get the callback table
|
||||
/* Get the callback table */
|
||||
mov rax, gs:[TePeb]
|
||||
mov r9, [rax + PeKernelCallbackTable]
|
||||
|
||||
; Call the routine
|
||||
/* Call the routine */
|
||||
call qword ptr [r9 + r8 * 8]
|
||||
|
||||
; Return from callback
|
||||
/* Return from callback */
|
||||
xor ecx, ecx
|
||||
xor edx, edx
|
||||
mov r8d, eax
|
||||
call ZwCallbackReturn
|
||||
|
||||
; Save callback return value
|
||||
/* Save callback return value */
|
||||
mov esi, eax
|
||||
|
||||
; Raise status
|
||||
/* Raise status */
|
||||
StatusRaise:
|
||||
mov ecx, esi
|
||||
call RtlRaiseStatus
|
||||
|
@ -158,11 +158,11 @@ EXTERN RtlRaiseException:PROC
|
|||
PUBLIC KiUserExceptionDispatcher
|
||||
.PROC KiUserExceptionDispatcher
|
||||
|
||||
; The stack is set up with a KUSER_EXCEPTION_STACK
|
||||
; The frame ends with a MACHINE_FRAME.
|
||||
/* The stack is set up with a KUSER_EXCEPTION_STACK */
|
||||
/* The frame ends with a MACHINE_FRAME. */
|
||||
.PUSHFRAME
|
||||
|
||||
; This is for the alignment, EXCEPTION_RECORD and CONTEXT
|
||||
/* This is for the alignment, EXCEPTION_RECORD and CONTEXT */
|
||||
.ALLOCSTACK 8 + EXCEPTION_RECORD_LENGTH + CONTEXT_FRAME_LENGTH
|
||||
.ENDPROLOG
|
||||
|
||||
|
@ -177,8 +177,8 @@ PUBLIC KiUserExceptionDispatcher
|
|||
jz RaiseException
|
||||
|
||||
/* We're fine, continue execution */
|
||||
lea rcx, [rsp] ; ContextRecord
|
||||
mov dl, 0 ; TestAlert
|
||||
lea rcx, [rsp] /* ContextRecord */
|
||||
mov dl, 0 /* TestAlert */
|
||||
call ZwContinue
|
||||
|
||||
/* Exit */
|
||||
|
@ -187,13 +187,13 @@ PUBLIC KiUserExceptionDispatcher
|
|||
RaiseException:
|
||||
|
||||
/* Raise the exception */
|
||||
lea rcx, [rsp + CONTEXT_FRAME_LENGTH] ; ExceptionRecord
|
||||
lea rdx, [rsp] ; ContextRecord
|
||||
lea rcx, [rsp + CONTEXT_FRAME_LENGTH] /* ExceptionRecord */
|
||||
lea rdx, [rsp] /* ContextRecord */
|
||||
xor r8, r8
|
||||
call ZwRaiseException
|
||||
|
||||
Exit:
|
||||
lea rcx, [rsp + CONTEXT_FRAME_LENGTH] ; ExceptionRecord
|
||||
lea rcx, [rsp + CONTEXT_FRAME_LENGTH] /* ExceptionRecord */
|
||||
mov rdx, rax
|
||||
call KiUserExceptionDispatcherNested
|
||||
ret
|
||||
|
|
|
@ -11,11 +11,13 @@
|
|||
|
||||
#include <ksamd64.inc>
|
||||
|
||||
; BOOLEAN
|
||||
; KiSwapContextResume(
|
||||
; _In_ KIRQL WaitIrql,
|
||||
; _In_ PKTHREAD OldThread,
|
||||
; _In_ PKTHREAD NewThread)
|
||||
/*
|
||||
* BOOLEAN
|
||||
* KiSwapContextResume(
|
||||
* _In_ KIRQL WaitIrql,
|
||||
* _In_ PKTHREAD OldThread,
|
||||
* _In_ PKTHREAD NewThread)
|
||||
*/
|
||||
EXTERN KiSwapContextResume:PROC
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
|
|
@ -825,7 +825,7 @@ no_user_apc_pending:
|
|||
/* Swap gs back to user */
|
||||
swapgs
|
||||
|
||||
; Zero out volatiles
|
||||
/* Zero out volatiles */
|
||||
pxor xmm0, xmm0
|
||||
pxor xmm1, xmm1
|
||||
pxor xmm2, xmm2
|
||||
|
@ -965,7 +965,7 @@ FUNC KiConvertToGuiThread
|
|||
test rax, rax
|
||||
jz KiConvertToGuiThreadFailed
|
||||
|
||||
; OldStack = KeSwitchKernelStack((PVOID)NewStack, (PVOID)(NewStack - KERNEL_STACK_SIZE));
|
||||
/* OldStack = KeSwitchKernelStack((PVOID)NewStack, (PVOID)(NewStack - KERNEL_STACK_SIZE)); */
|
||||
mov rcx, rax
|
||||
mov rdx, rax
|
||||
sub rdx, KERNEL_STACK_SIZE
|
||||
|
@ -1011,44 +1011,45 @@ KiConvertToGuiThreadFailed:
|
|||
|
||||
ENDFUNC
|
||||
|
||||
;
|
||||
; VOID
|
||||
; KiDeliverApc(
|
||||
; _In_ KPROCESSOR_MODE DeliveryMode,
|
||||
; _In_ PKEXCEPTION_FRAME ExceptionFrame,
|
||||
; _In_ PKTRAP_FRAME TrapFrame);
|
||||
;
|
||||
/*
|
||||
* VOID
|
||||
* KiDeliverApc(
|
||||
* _In_ KPROCESSOR_MODE DeliveryMode,
|
||||
* _In_ PKEXCEPTION_FRAME ExceptionFrame,
|
||||
* _In_ PKTRAP_FRAME TrapFrame);
|
||||
*
|
||||
*/
|
||||
EXTERN KiDeliverApc:PROC
|
||||
|
||||
PUBLIC KiInitiateUserApc
|
||||
.PROC KiInitiateUserApc
|
||||
|
||||
; Generate a KEXCEPTION_FRAME on the stack
|
||||
/* Generate a KEXCEPTION_FRAME on the stack */
|
||||
GENERATE_EXCEPTION_FRAME
|
||||
|
||||
; Raise IRQL to APC_LEVEL
|
||||
/* Raise IRQL to APC_LEVEL */
|
||||
mov rax, APC_LEVEL
|
||||
mov cr8, rax
|
||||
|
||||
; Enable interrupts
|
||||
/* Enable interrupts */
|
||||
sti
|
||||
|
||||
; Get the current trap frame
|
||||
/* Get the current trap frame */
|
||||
mov rax, gs:[PcCurrentThread]
|
||||
mov r8, [rax + KTHREAD_TrapFrame]
|
||||
|
||||
; Call the C function
|
||||
/* Call the C function */
|
||||
mov ecx, 1
|
||||
mov rdx, rsp
|
||||
call KiDeliverApc
|
||||
|
||||
; Disable interrupts again
|
||||
/* Disable interrupts again */
|
||||
cli
|
||||
|
||||
; Restore the registers from the KEXCEPTION_FRAME
|
||||
/* Restore the registers from the KEXCEPTION_FRAME */
|
||||
RESTORE_EXCEPTION_STATE
|
||||
|
||||
; Return
|
||||
/* Return */
|
||||
ret
|
||||
|
||||
.ENDP
|
||||
|
@ -1092,22 +1093,22 @@ FUNC KeSwitchKernelStack
|
|||
sub rsp, 40
|
||||
.allocstack 40
|
||||
|
||||
; Save rcx
|
||||
/* Save rcx */
|
||||
mov [rsp], rcx
|
||||
.savereg rcx, 0
|
||||
.endprolog
|
||||
|
||||
; Call the C handler, which returns the old stack in rax
|
||||
call KiSwitchKernelStack
|
||||
/* Call the C handler, which returns the old stack in rax */
|
||||
call KiSwitchKernelStack
|
||||
|
||||
; Restore rcx (StackBase)
|
||||
/* Restore rcx (StackBase) */
|
||||
mov rcx, [rsp]
|
||||
|
||||
; Switch to new stack: RSP += (StackBase - OldStackBase)
|
||||
/* Switch to new stack: RSP += (StackBase - OldStackBase) */
|
||||
sub rcx, rax
|
||||
add rsp, rcx
|
||||
|
||||
; Deallocate the home frame
|
||||
/* Deallocate the home frame */
|
||||
add rsp, 40
|
||||
ret
|
||||
|
||||
|
|
|
@ -1,72 +1,72 @@
|
|||
;++
|
||||
; PROJECT: ReactOS Kernel
|
||||
; LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
||||
; PURPOSE: ReactOS AMD64 user mode callback helper
|
||||
; COPYRIGHT: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
;--
|
||||
/*
|
||||
* PROJECT: ReactOS Kernel
|
||||
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
||||
* PURPOSE: ReactOS AMD64 user mode callback helper
|
||||
* COPYRIGHT: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
#include <ksamd64.inc>
|
||||
|
||||
;
|
||||
; NTSTATUS
|
||||
; KiUserModeCallout (
|
||||
; _Inout_ PKCALLOUT_FRAME CalloutFrame);
|
||||
;
|
||||
/*
|
||||
* NTSTATUS
|
||||
* KiUserModeCallout (
|
||||
* _Inout_ PKCALLOUT_FRAME CalloutFrame);
|
||||
*/
|
||||
EXTERN KiUserModeCallout:PROC
|
||||
|
||||
.code64
|
||||
|
||||
;
|
||||
; NTSTATUS
|
||||
; KiCallUserMode (
|
||||
; _In_ PVOID *OutputBuffer@<rcx>,
|
||||
; _In_ PULONG OutputLength@<rdx>);
|
||||
;
|
||||
/*
|
||||
* NTSTATUS
|
||||
* KiCallUserMode (
|
||||
* _In_ PVOID *OutputBuffer@<rcx>,
|
||||
* _In_ PULONG OutputLength@<rdx>);
|
||||
*/
|
||||
PUBLIC KiCallUserMode
|
||||
.PROC KiCallUserMode
|
||||
|
||||
; Generate a KEXCEPTION_FRAME on the stack
|
||||
; This is identical to a KCALLOUT_FRAME
|
||||
/* Generate a KEXCEPTION_FRAME on the stack */
|
||||
/* This is identical to a KCALLOUT_FRAME */
|
||||
GENERATE_EXCEPTION_FRAME
|
||||
|
||||
; Save OutputBuffer and OutputLength
|
||||
/* Save OutputBuffer and OutputLength */
|
||||
mov [rsp + ExOutputBuffer], rcx
|
||||
mov [rsp + ExOutputLength], rdx
|
||||
|
||||
; Call the C function
|
||||
/* Call the C function */
|
||||
mov rcx, rsp
|
||||
call KiUserModeCallout
|
||||
|
||||
; Restore the registers from the KEXCEPTION_FRAME
|
||||
/* Restore the registers from the KEXCEPTION_FRAME */
|
||||
RESTORE_EXCEPTION_STATE
|
||||
|
||||
; Return
|
||||
/* Return */
|
||||
ret
|
||||
|
||||
.ENDP
|
||||
|
||||
;
|
||||
; DECLSPEC_NORETURN
|
||||
; VOID
|
||||
; KiCallbackReturn (
|
||||
; _In_ PVOID Stack,
|
||||
; _In_ NTSTATUS Status);
|
||||
;
|
||||
/*
|
||||
* DECLSPEC_NORETURN
|
||||
* VOID
|
||||
* KiCallbackReturn (
|
||||
* _In_ PVOID Stack,
|
||||
* _In_ NTSTATUS Status);
|
||||
*/
|
||||
PUBLIC KiCallbackReturn
|
||||
.PROC KiCallbackReturn
|
||||
|
||||
.ENDPROLOG
|
||||
|
||||
; Restore the stack
|
||||
/* Restore the stack */
|
||||
mov rsp, rcx
|
||||
|
||||
; Set return status
|
||||
/* Set return status */
|
||||
mov eax, edx
|
||||
|
||||
; Restore the registers from the KEXCEPTION_FRAME
|
||||
/* Restore the registers from the KEXCEPTION_FRAME */
|
||||
RESTORE_EXCEPTION_STATE
|
||||
|
||||
; Return
|
||||
/* Return */
|
||||
ret
|
||||
|
||||
.ENDP
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
;++
|
||||
; PROJECT: ReactOS SDK
|
||||
; LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
||||
; PURPOSE: ReactOS AMD64 architecture asm macros
|
||||
; COPYRIGHT: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
;--
|
||||
/*
|
||||
* PROJECT: ReactOS SDK
|
||||
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
||||
* PURPOSE: ReactOS AMD64 architecture asm macros
|
||||
* COPYRIGHT: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
#include <macamd64.inc>
|
||||
|
||||
MACRO(GENERATE_EXCEPTION_FRAME)
|
||||
|
||||
; Allocate a KEXCEPTION_FRAME on the stack
|
||||
; -8 because the last field is the return address
|
||||
/* Allocate a KEXCEPTION_FRAME on the stack */
|
||||
/* -8 because the last field is the return address */
|
||||
sub rsp, KEXCEPTION_FRAME_LENGTH - 8
|
||||
.allocstack KEXCEPTION_FRAME_LENGTH - 8
|
||||
|
||||
; Save non-volatiles in KEXCEPTION_FRAME
|
||||
/* Save non-volatiles in KEXCEPTION_FRAME */
|
||||
mov [rsp + ExRbp], rbp
|
||||
.savereg rbp, ExRbp
|
||||
mov [rsp + ExRbx], rbx
|
||||
|
@ -56,7 +56,7 @@ ENDM
|
|||
|
||||
MACRO(RESTORE_EXCEPTION_STATE)
|
||||
|
||||
; Restore non-volatile registers
|
||||
/* Restore non-volatile registers */
|
||||
mov rbp, [rsp + ExRbp]
|
||||
mov rbx, [rsp + ExRbx]
|
||||
mov rdi, [rsp + ExRdi]
|
||||
|
@ -76,7 +76,7 @@ MACRO(RESTORE_EXCEPTION_STATE)
|
|||
movaps xmm14, [rsp + ExXmm14]
|
||||
movaps xmm15, [rsp + ExXmm15]
|
||||
|
||||
; Clean stack and return
|
||||
/* Clean stack and return */
|
||||
add rsp, KEXCEPTION_FRAME_LENGTH - 8
|
||||
|
||||
ENDM
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
;++
|
||||
; PROJECT: ReactOS SDK
|
||||
; LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
||||
; PURPOSE: ReactOS AMD64 architecture asm macros
|
||||
; COPYRIGHT: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
;--
|
||||
/*
|
||||
* PROJECT: ReactOS SDK
|
||||
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
||||
* PURPOSE: ReactOS AMD64 architecture asm macros
|
||||
* COPYRIGHT: Timo Kreuzer (timo.kreuzer@reactos.org)
|
||||
*/
|
||||
|
||||
#include <asm.inc>
|
||||
|
||||
|
@ -156,4 +156,4 @@ MACRO(Yield)
|
|||
pause
|
||||
ENDM
|
||||
|
||||
; EOF
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue