ASSUME CS:NOTHING, DS:NOTHING, ES:NOTHING, FS:NOTHING, GS:NOTHING\r
#endif\r
\r
-/* Hex numbers need to be in 01ABh format */\r
+/* Explicit radix in MASM syntax */\r
+#define BIN(x) x##y\r
+#define OCT(x) x##q\r
+#define DEC(x) x##t\r
#define HEX(x) 0##x##h\r
\r
-/* Macro values need to be marked */\r
+/* Macro values need not be marked */\r
#define VAL(x) x\r
\r
/* MASM/ML doesn't want explicit [rip] addressing */\r
ENDM\r
#define ENDFUNC .ENDP\r
\r
+/* Global labels need an extra colon */\r
+GLOBAL_LABEL MACRO label\r
+ %label::\r
+ENDM\r
+\r
/* check http://msdn.microsoft.com/en-us/library/9c9k076y%28VS.80%29.aspx\r
and http://msdn.microsoft.com/en-us/library/ms679352%28VS.85%29.aspx */\r
FPO MACRO cdwLocals, cdwParams, cbProlog, cbRegs, fUseBP, cbFrame\r
\r
.altmacro\r
\r
-/* Hex numbers need to be in 0x1AB format */\r
-#define HEX(y) 0x##y\r
+/* Explicit radix in GAS syntax */\r
+#define BIN(x) 0b##x\r
+#define OCT(x) 0##x\r
+#define DEC(x) x\r
+#define HEX(x) 0x##x\r
\r
/* Macro values need to be marked */\r
#define VAL(x) \x\r
.global \symbol\r
.endm\r
\r
+/* No special marking of global labels */\r
+.macro GLOBAL_LABEL label\r
+ \label:\r
+.endm\r
+\r
/* Dummy ASSUME */\r
.macro ASSUME p1 p2 p3 p4 p5 p6 p7 p8\r
.endm\r
#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 ***************************************************************/
.code
+PUBLIC _DbgBreakPointNoBugCheck@0
FUNC _DbgBreakPointNoBugCheck@0
FPO 0, 0, 0, 0, 0, FRAME_FPO
+
+ /* Do breakpoint */
int 3
ret
+
ENDFUNC
+
+PUBLIC _DbgUserBreakPoint@0
_DbgUserBreakPoint@0:
+PUBLIC _DbgBreakPoint@0
FUNC _DbgBreakPoint@0
FPO 0, 0, 0, 0, 0, FRAME_FPO
+
+ /* Do breakpoint */
int 3
ret
+
ENDFUNC
+
+PUBLIC _DbgBreakPointWithStatus@4
FUNC _DbgBreakPointWithStatus@4
FPO 0, 1, 0, 0, 0, FRAME_FPO
+
+ /* Put Status in EAX */
mov eax, [esp+4]
-ENDFUNC
-FUNC _RtlpBreakWithStatusInstruction@0
- FPO 0, 0, 0, 0, 0, FRAME_FPO
+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
ret 4
+
ENDFUNC
+
+PUBLIC _DebugService2@12
FUNC _DebugService2@12
FPO 0, 3, 3, 0, 1, FRAME_NONFPO
- /* Setup the stack */
+ /* Set up the stack */
push ebp
mov ebp, esp
int HEX(2D)
int 3
- /* Restore stack */
+ /* Return */
pop ebp
ret 12
+
ENDFUNC
+
+PUBLIC _DebugService@20
FUNC _DebugService@20
FPO 0, 5, 3, 0, 1, FRAME_NONFPO
- /* Setup the stack */
+ /* Set up the stack */
push ebp
mov ebp, esp
- /* Save the registers */
+ /* Save non-volatiles */
push ebx
push edi
int HEX(2D)
int 3
- /* Restore registers */
+ /* Restore non-volatiles */
pop edi
pop ebx
/* Return */
pop ebp
ret 20
+
ENDFUNC
END