xref: /reactos/sdk/lib/rtl/arm/debug_asm.S (revision 5100859e)
1/*
2 * PROJECT:         ReactOS Kernel
3 * LICENSE:         BSD - See COPYING.ARM in the top level directory
4 * FILE:            lib/rtl/arm/debug_asm.S
5 * PURPOSE:         Cross-privilege Debugging and Exception Support for ARM
6 * PROGRAMMERS:     ReactOS Portable Systems Group
7 */
8
9#include <ksarm.h>
10
11    TEXTAREA
12
13    LEAF_ENTRY DbgBreakPoint
14    __debugbreak
15    bx lr
16    LEAF_END DbgBreakPoint
17
18    LEAF_ENTRY DbgUserBreakPoint
19    __debugbreak
20    bx lr
21    LEAF_END DbgUserBreakPoint
22
23    LEAF_ENTRY DbgBreakPointWithStatus
24    __debugbreak
25    bx lr
26    LEAF_END
27
28    LEAF_ENTRY RtlpBreakWithStatusInstruction
29    __debugbreak
30    bx lr
31    LEAF_END
32
33    LEAF_ENTRY DebugService
34    __debugservice
35    //bkpt BREAKPOINT_PRINT // Could be prompt too, we check this later
36    bx lr
37    LEAF_END DebugService
38
39    LEAF_ENTRY DebugService2
40    //bkpt BREAKPOINT_LOAD_SYMBOLS // Could be unload too, we check this later
41    bx lr
42    LEAF_END DebugService2
43
44    LEAF_ENTRY RtlCaptureContext
45
46    // FIXME-PERF: Change to stmdb later
47    str r0, [a1, #CxR0]
48    str r1, [a1, #CxR1]
49    str r2, [a1, #CxR2]
50    str r3, [a1, #CxR3]
51    str r4, [a1, #CxR4]
52    str r5, [a1, #CxR5]
53    str r6, [a1, #CxR6]
54    str r7, [a1, #CxR7]
55    str r8, [a1, #CxR8]
56    str r9, [a1, #CxR9]
57    str r10, [a1, #CxR10]
58    str r11, [a1, #CxR11]
59    str r12, [a1, #CxR12]
60
61    str sp, [a1, #CxSp]
62    str lr, [a1, #CxLr]
63
64    /* Need to do this indirectly, since "str pc, [a1, #CxPc]" generates
65       unpredictable behavior (error A2193) */
66    mov ip, pc
67    str ip, [a1, #CxPc]
68    mrs ip, spsr
69    str ip, [a1, #CxCpsr]
70
71    // FIXME: Fpscr and remaining stuff
72
73    /* Set flags */
74    mov32 r0, #CONTEXT_FULL
75    str ip, [a1, #CxContextFlags]
76
77    /* Return */
78    bx lr
79    LEAF_END RtlCaptureContext
80
81    END
82/* EOF */
83