mirror of
https://github.com/reactos/reactos.git
synced 2025-05-31 15:08:14 +00:00
[RTL]
Merge DbgBreakPointWithStatus and RtlpBreakWithStatusInstruction together as one function (the latter is just a label for KD), and add new macro necessary for this (MASM very much wants "::" on a global label inside a PROC local scope). Timo, you are awesome. Bonus: Complement HEX()'s awesomeness with the other explicit radix specifiers. svn path=/trunk/; revision=69515
This commit is contained in:
parent
540d4a2f95
commit
00e97e51bb
2 changed files with 57 additions and 23 deletions
|
@ -21,10 +21,13 @@ OPTION DOTNAME
|
||||||
ASSUME CS:NOTHING, DS:NOTHING, ES:NOTHING, FS:NOTHING, GS:NOTHING
|
ASSUME CS:NOTHING, DS:NOTHING, ES:NOTHING, FS:NOTHING, GS:NOTHING
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Hex numbers need to be in 01ABh format */
|
/* Explicit radix in MASM syntax */
|
||||||
|
#define BIN(x) x##y
|
||||||
|
#define OCT(x) x##q
|
||||||
|
#define DEC(x) x##t
|
||||||
#define HEX(x) 0##x##h
|
#define HEX(x) 0##x##h
|
||||||
|
|
||||||
/* Macro values need to be marked */
|
/* Macro values need not be marked */
|
||||||
#define VAL(x) x
|
#define VAL(x) x
|
||||||
|
|
||||||
/* MASM/ML doesn't want explicit [rip] addressing */
|
/* MASM/ML doesn't want explicit [rip] addressing */
|
||||||
|
@ -50,6 +53,11 @@ ENDM
|
||||||
ENDM
|
ENDM
|
||||||
#define ENDFUNC .ENDP
|
#define ENDFUNC .ENDP
|
||||||
|
|
||||||
|
/* Global labels need an extra colon */
|
||||||
|
GLOBAL_LABEL MACRO label
|
||||||
|
%label::
|
||||||
|
ENDM
|
||||||
|
|
||||||
/* check http://msdn.microsoft.com/en-us/library/9c9k076y%28VS.80%29.aspx
|
/* check http://msdn.microsoft.com/en-us/library/9c9k076y%28VS.80%29.aspx
|
||||||
and http://msdn.microsoft.com/en-us/library/ms679352%28VS.85%29.aspx */
|
and http://msdn.microsoft.com/en-us/library/ms679352%28VS.85%29.aspx */
|
||||||
FPO MACRO cdwLocals, cdwParams, cbProlog, cbRegs, fUseBP, cbFrame
|
FPO MACRO cdwLocals, cdwParams, cbProlog, cbRegs, fUseBP, cbFrame
|
||||||
|
@ -193,8 +201,11 @@ ENDM
|
||||||
|
|
||||||
.altmacro
|
.altmacro
|
||||||
|
|
||||||
/* Hex numbers need to be in 0x1AB format */
|
/* Explicit radix in GAS syntax */
|
||||||
#define HEX(y) 0x##y
|
#define BIN(x) 0b##x
|
||||||
|
#define OCT(x) 0##x
|
||||||
|
#define DEC(x) x
|
||||||
|
#define HEX(x) 0x##x
|
||||||
|
|
||||||
/* Macro values need to be marked */
|
/* Macro values need to be marked */
|
||||||
#define VAL(x) \x
|
#define VAL(x) \x
|
||||||
|
@ -228,6 +239,11 @@ ENDM
|
||||||
.global \symbol
|
.global \symbol
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
/* No special marking of global labels */
|
||||||
|
.macro GLOBAL_LABEL label
|
||||||
|
\label:
|
||||||
|
.endm
|
||||||
|
|
||||||
/* Dummy ASSUME */
|
/* Dummy ASSUME */
|
||||||
.macro ASSUME p1 p2 p3 p4 p5 p6 p7 p8
|
.macro ASSUME p1 p2 p3 p4 p5 p6 p7 p8
|
||||||
.endm
|
.endm
|
||||||
|
|
|
@ -8,48 +8,62 @@
|
||||||
|
|
||||||
#include <asm.inc>
|
#include <asm.inc>
|
||||||
|
|
||||||
/* GLOBALS ****************************************************************/
|
|
||||||
|
|
||||||
PUBLIC _DbgBreakPoint@0
|
|
||||||
PUBLIC _DbgBreakPointWithStatus@4
|
|
||||||
PUBLIC _DbgUserBreakPoint@0
|
|
||||||
PUBLIC _DebugService@20
|
|
||||||
PUBLIC _DebugService2@12
|
|
||||||
PUBLIC _DbgBreakPointNoBugCheck@0
|
|
||||||
PUBLIC _RtlpBreakWithStatusInstruction@0
|
|
||||||
|
|
||||||
/* FUNCTIONS ***************************************************************/
|
/* FUNCTIONS ***************************************************************/
|
||||||
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
|
PUBLIC _DbgBreakPointNoBugCheck@0
|
||||||
FUNC _DbgBreakPointNoBugCheck@0
|
FUNC _DbgBreakPointNoBugCheck@0
|
||||||
FPO 0, 0, 0, 0, 0, FRAME_FPO
|
FPO 0, 0, 0, 0, 0, FRAME_FPO
|
||||||
|
|
||||||
|
/* Do breakpoint */
|
||||||
int 3
|
int 3
|
||||||
ret
|
ret
|
||||||
|
|
||||||
ENDFUNC
|
ENDFUNC
|
||||||
|
|
||||||
|
|
||||||
|
PUBLIC _DbgUserBreakPoint@0
|
||||||
_DbgUserBreakPoint@0:
|
_DbgUserBreakPoint@0:
|
||||||
|
PUBLIC _DbgBreakPoint@0
|
||||||
FUNC _DbgBreakPoint@0
|
FUNC _DbgBreakPoint@0
|
||||||
FPO 0, 0, 0, 0, 0, FRAME_FPO
|
FPO 0, 0, 0, 0, 0, FRAME_FPO
|
||||||
|
|
||||||
|
/* Do breakpoint */
|
||||||
int 3
|
int 3
|
||||||
ret
|
ret
|
||||||
|
|
||||||
ENDFUNC
|
ENDFUNC
|
||||||
|
|
||||||
|
|
||||||
|
PUBLIC _DbgBreakPointWithStatus@4
|
||||||
FUNC _DbgBreakPointWithStatus@4
|
FUNC _DbgBreakPointWithStatus@4
|
||||||
FPO 0, 1, 0, 0, 0, FRAME_FPO
|
FPO 0, 1, 0, 0, 0, FRAME_FPO
|
||||||
mov eax, [esp+4]
|
|
||||||
ENDFUNC
|
|
||||||
|
|
||||||
FUNC _RtlpBreakWithStatusInstruction@0
|
/* Put Status in EAX */
|
||||||
FPO 0, 0, 0, 0, 0, FRAME_FPO
|
mov eax, [esp+4]
|
||||||
|
|
||||||
|
PUBLIC _RtlpBreakWithStatusInstruction@0
|
||||||
|
GLOBAL_LABEL _RtlpBreakWithStatusInstruction@0
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Do a "labeled" breakpoint -- the KD data block has a "BreakpointWithStatus" field
|
||||||
|
* pointing to this label, letting a debugger easily check that a breakpoint has occured here
|
||||||
|
* and thereby know that there is a Status for it to retrieve from EAX
|
||||||
|
*
|
||||||
|
* In other words, Status is passed as an argument directly to the debugger
|
||||||
|
*/
|
||||||
int 3
|
int 3
|
||||||
ret 4
|
ret 4
|
||||||
|
|
||||||
ENDFUNC
|
ENDFUNC
|
||||||
|
|
||||||
|
|
||||||
|
PUBLIC _DebugService2@12
|
||||||
FUNC _DebugService2@12
|
FUNC _DebugService2@12
|
||||||
FPO 0, 3, 3, 0, 1, FRAME_NONFPO
|
FPO 0, 3, 3, 0, 1, FRAME_NONFPO
|
||||||
|
|
||||||
/* Setup the stack */
|
/* Set up the stack */
|
||||||
push ebp
|
push ebp
|
||||||
mov ebp, esp
|
mov ebp, esp
|
||||||
|
|
||||||
|
@ -60,19 +74,22 @@ FUNC _DebugService2@12
|
||||||
int HEX(2D)
|
int HEX(2D)
|
||||||
int 3
|
int 3
|
||||||
|
|
||||||
/* Restore stack */
|
/* Return */
|
||||||
pop ebp
|
pop ebp
|
||||||
ret 12
|
ret 12
|
||||||
|
|
||||||
ENDFUNC
|
ENDFUNC
|
||||||
|
|
||||||
|
|
||||||
|
PUBLIC _DebugService@20
|
||||||
FUNC _DebugService@20
|
FUNC _DebugService@20
|
||||||
FPO 0, 5, 3, 0, 1, FRAME_NONFPO
|
FPO 0, 5, 3, 0, 1, FRAME_NONFPO
|
||||||
|
|
||||||
/* Setup the stack */
|
/* Set up the stack */
|
||||||
push ebp
|
push ebp
|
||||||
mov ebp, esp
|
mov ebp, esp
|
||||||
|
|
||||||
/* Save the registers */
|
/* Save non-volatiles */
|
||||||
push ebx
|
push ebx
|
||||||
push edi
|
push edi
|
||||||
|
|
||||||
|
@ -85,13 +102,14 @@ FUNC _DebugService@20
|
||||||
int HEX(2D)
|
int HEX(2D)
|
||||||
int 3
|
int 3
|
||||||
|
|
||||||
/* Restore registers */
|
/* Restore non-volatiles */
|
||||||
pop edi
|
pop edi
|
||||||
pop ebx
|
pop ebx
|
||||||
|
|
||||||
/* Return */
|
/* Return */
|
||||||
pop ebp
|
pop ebp
|
||||||
ret 20
|
ret 20
|
||||||
|
|
||||||
ENDFUNC
|
ENDFUNC
|
||||||
|
|
||||||
END
|
END
|
||||||
|
|
Loading…
Reference in a new issue