xref: /reactos/sdk/lib/rtl/amd64/debug_asm.S (revision 8a978a17)
1/*
2 * COPYRIGHT:         See COPYING in the top level directory
3 * PROJECT:           ReactOS Run-Time Library
4 * PURPOSE:           Debug Routines
5 * FILE:              lib/rtl/amd64/debug_asm.S
6 * PROGRAMER:         Timo Kreuzer (timo.kreuzer@reactos.org)
7 */
8
9#include <asm.inc>
10
11/* GLOBALS ****************************************************************/
12
13PUBLIC DbgBreakPoint
14PUBLIC DbgBreakPointWithStatus
15PUBLIC DbgUserBreakPoint
16PUBLIC DebugService
17PUBLIC DebugService2
18PUBLIC DbgBreakPointNoBugCheck
19PUBLIC RtlpBreakWithStatusInstruction
20
21/* FUNCTIONS ***************************************************************/
22
23.code64
24
25.PROC DbgBreakPointNoBugCheck
26    .endprolog
27    int 3
28    ret
29.ENDP
30
31DbgUserBreakPoint:
32.PROC DbgBreakPoint
33    .endprolog
34    int 3
35    ret
36.ENDP
37
38.PROC DbgBreakPointWithStatus
39    .endprolog
40    mov eax, ecx
41.ENDP
42
43.PROC RtlpBreakWithStatusInstruction
44    .endprolog
45    int 3
46    ret
47.ENDP
48
49DebugService2:
50
51    /* Pass the service number in eax */
52    mov rax, r8
53    int HEX(2D)
54    int 3
55    ret
56
57
58/******************************************************************************
59 * NTSTATUS NTAPI DebugService(
60 *     IN ULONG Service,    // <rcx> = [rsp + 8]
61 *     IN PVOID Buffer,     // <rdx> = [rsp + 16]
62 *     IN ULONG Length,     // <r8>  = [rsp + 24]
63 *     IN PVOID Argument1,  // <r9>  = [rsp + 32]
64 *     IN PVOID Argument2); //         [rsp + 40]
65 */
66DebugService:
67
68    /* Prepare registers for interrupt */
69    mov eax, ecx       // Service
70    mov rcx, rdx       // Buffer
71    mov edx, r8d       // Length
72    mov r8, r9         // Argument1
73    mov r9, [rsp + 40] // Argument2
74
75    /* Call the Interrupt */
76    int HEX(2D)
77    int 3
78
79   /* Return */
80    ret
81
82END
83