xref: /reactos/sdk/lib/rtl/i386/debug_asm.S (revision dc0433f0)
1/*
2 * COPYRIGHT:         See COPYING in the top level directory
3 * PROJECT:           ReactOS Run-Time Library
4 * PURPOSE:           Debug Routines
5 * FILE:              lib/rtl/i386/debug_asm.S
6 * PROGRAMER:         Alex Ionescu (alex@relsoft.net)
7 */
8
9#include <asm.inc>
10
11/* FUNCTIONS ***************************************************************/
12
13.code
14
15PUBLIC _DbgBreakPointNoBugCheck@0
16FUNC _DbgBreakPointNoBugCheck@0
17    FPO 0, 0, 0, 0, 0, FRAME_FPO
18
19    /* Do breakpoint */
20    int 3
21    ret
22
23ENDFUNC
24
25
26PUBLIC _DbgUserBreakPoint@0
27_DbgUserBreakPoint@0:
28PUBLIC _DbgBreakPoint@0
29FUNC _DbgBreakPoint@0
30    FPO 0, 0, 0, 0, 0, FRAME_FPO
31
32    /* Do breakpoint */
33    int 3
34    ret
35
36ENDFUNC
37
38
39PUBLIC _DbgBreakPointWithStatus@4
40FUNC _DbgBreakPointWithStatus@4
41    FPO 0, 1, 0, 0, 0, FRAME_FPO
42
43    /* Put Status in EAX */
44    mov eax, [esp+4]
45
46PUBLIC _RtlpBreakWithStatusInstruction@0
47GLOBAL_LABEL _RtlpBreakWithStatusInstruction@0
48
49    /*
50     * Do a "labeled" breakpoint -- the KD data block has a "BreakpointWithStatus" field
51     * pointing to this label, letting a debugger easily check that a breakpoint has occured here
52     * and thereby know that there is a Status for it to retrieve from EAX
53     *
54     * In other words, Status is passed as an argument directly to the debugger
55     */
56    int 3
57    ret 4
58
59ENDFUNC
60
61
62PUBLIC _DebugService2@12
63FUNC _DebugService2@12
64    FPO 0, 3, 3, 0, 1, FRAME_NONFPO
65
66    /* Set up the stack */
67    push ebp
68    CFI_ADJUST_CFA_OFFSET 4
69    CFI_REL_OFFSET ebp, 0
70    mov ebp, esp
71    CFI_DEF_CFA_REGISTER ebp
72
73    /* Call the interrupt */
74    mov eax, [ebp+16]
75    mov ecx, [ebp+8]
76    mov edx, [ebp+12]
77    int HEX(2D)
78    int 3
79
80    /* Return */
81    pop ebp
82    CFI_SAME_VALUE ebp
83    CFI_DEF_CFA esp, 12
84    ret 12
85
86ENDFUNC
87
88
89PUBLIC _DebugService@20
90FUNC _DebugService@20
91    FPO 0, 5, 3, 0, 1, FRAME_NONFPO
92
93    /* Set up the stack */
94    push ebp
95    CFI_ADJUST_CFA_OFFSET 4
96    CFI_REL_OFFSET ebp, 0
97    mov ebp, esp
98    CFI_DEF_CFA_REGISTER ebp
99
100    /* Save non-volatiles */
101    push ebx
102    CFI_REL_OFFSET ebx, -4
103    push edi
104    CFI_REL_OFFSET edi, -8
105
106    /* Call the Interrupt */
107    mov eax, [ebp+8]
108    mov ecx, [ebp+12]
109    mov edx, [ebp+16]
110    mov ebx, [ebp+20]
111    mov edi, [ebp+24]
112    int HEX(2D)
113    int 3
114
115    /* Restore non-volatiles */
116    pop edi
117    CFI_SAME_VALUE edi
118    pop ebx
119    CFI_SAME_VALUE ebx
120
121    /* Return */
122    pop ebp
123    CFI_SAME_VALUE ebp
124    CFI_DEF_CFA esp, 20
125    ret 20
126
127ENDFUNC
128
129END
130