reactos/sdk/lib/rtl/amd64/debug_asm.S
Hermès Bélusca-Maïto 005f75bd61
[RTL] x64/ARM: Alias RtlpBreakWithStatusInstruction to DbgBreakPointWithStatus; x64: fix a bug.
RtlpBreakWithStatusInstruction is just a label for KD.

On machines that have register calling conventions (basically all except
x86), the `Status` parameter for `DbgBreakPointWithStatus` is stored in
the first argument register.

https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-dbgbreakpointwithstatus

On the x64 platform, `DbgBreakPointWithStatus` only uses the ECX register
and leaves EAX untouched. Verified on Windows.
2025-04-19 20:01:08 +02:00

68 lines
1.5 KiB
ArmAsm

/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Run-Time Library
* PURPOSE: Debug Routines
* FILE: lib/rtl/amd64/debug_asm.S
* PROGRAMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
#include <asm.inc>
/* FUNCTIONS ***************************************************************/
.code64
PUBLIC DbgUserBreakPoint
DbgUserBreakPoint:
PUBLIC DbgBreakPoint
.PROC DbgBreakPoint
.endprolog
int 3
ret
.ENDP
PUBLIC RtlpBreakWithStatusInstruction
RtlpBreakWithStatusInstruction:
PUBLIC DbgBreakPointWithStatus
.PROC DbgBreakPointWithStatus
.endprolog
int 3
ret
.ENDP
PUBLIC DebugService2
DebugService2:
/* Pass the service number in eax */
mov rax, r8
int HEX(2D)
int 3
ret
/******************************************************************************
* NTSTATUS NTAPI DebugService(
* IN ULONG Service, // <rcx> = [rsp + 8]
* IN PVOID Buffer, // <rdx> = [rsp + 16]
* IN ULONG Length, // <r8> = [rsp + 24]
* IN PVOID Argument1, // <r9> = [rsp + 32]
* IN PVOID Argument2); // [rsp + 40]
*/
PUBLIC DebugService
DebugService:
/* Prepare registers for interrupt */
mov eax, ecx // Service
mov rcx, rdx // Buffer
mov edx, r8d // Length
mov r8, r9 // Argument1
mov r9, [rsp + 40] // Argument2
/* Call the Interrupt */
int HEX(2D)
int 3
/* Return */
ret
END