[syslinux:lwip] core: Add "dprint" facility to assembly

syslinux-bot for H. Peter Anvin hpa at zytor.com
Mon Jun 27 18:39:03 PDT 2011


Commit-ID:  de86893bf5692743983420bad1a3b37fbb8dbdd2
Gitweb:     http://syslinux.zytor.com/commit/de86893bf5692743983420bad1a3b37fbb8dbdd2
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Mon, 27 Jun 2011 18:37:00 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Mon, 27 Jun 2011 18:37:00 -0700

core: Add "dprint" facility to assembly

Add a "dprint" facility to the assembly files, which simply calls
dprintf if debugging is enabled.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 core/debug.c    |    7 +++++++
 core/extern.inc |   18 ++++++++++++++++++
 mk/syslinux.mk  |   11 +++++++----
 3 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/core/debug.c b/core/debug.c
new file mode 100644
index 0000000..2824573
--- /dev/null
+++ b/core/debug.c
@@ -0,0 +1,7 @@
+#include "core.h"
+#include <dprintf.h>
+
+void pm_debug_msg(com32sys_t *regs)
+{
+    dprintf("%s\n", MK_PTR(0, regs->eax.w[0]));
+}
diff --git a/core/extern.inc b/core/extern.inc
index 3858f70..802d72a 100644
--- a/core/extern.inc
+++ b/core/extern.inc
@@ -33,6 +33,24 @@
 	; dmi.c
 	extern dmi_init
 
+%ifdef DEBUG
+	; debug.c
+	extern pm_debug_msg
+
+  %macro dprint 1+
+	push ax
+	call %%fwd
+	db %1
+	db 0
+%%fwd:	pop ax
+	pm_call pm_debug_msg
+	pop ax
+  %endmacro
+%else
+  %macro dprint 1+
+  %endmacro
+%endif
+
 %if IS_PXELINUX
 	; pxe.c
 	extern unload_pxe, reset_pxe, http_bake_cookies
diff --git a/mk/syslinux.mk b/mk/syslinux.mk
index 6d87187..5b7100f 100644
--- a/mk/syslinux.mk
+++ b/mk/syslinux.mk
@@ -32,8 +32,13 @@ COM32DIR = $(AUXDIR)/com32
 BOOTDIR	    = /boot
 EXTLINUXDIR = $(BOOTDIR)/extlinux
 
+ifdef DEBUG
+# This allows DEBUGOPT to be set from the command line
+DEBUGOPT = -DDEBUG=$(DEBUG)
+endif
+
 NASM	 = nasm
-NASMOPT  = -Ox
+NASMOPT  = -Ox $(DEBUGOPT)
 
 PERL	 = perl
 UPX	 = upx
@@ -66,9 +71,7 @@ WGET	 = wget
 com32    = $(topdir)/com32
 
 # Common warnings we want for all gcc-generated code
-GCCWARN := -W -Wall -Wstrict-prototypes
-# Extremely useful variant for debugging...
-#GCCWARN += -Wno-clobbered -Werror
+GCCWARN  = -W -Wall -Wstrict-prototypes $(DEBUGOPT)
 
 # Common stanza to make gcc generate .*.d dependency files
 MAKEDEPS = -Wp,-MT,$@,-MD,$(dir $@).$(notdir $@).d



More information about the Syslinux-commits mailing list