aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2011-06-27 18:37:00 -0700
committerH. Peter Anvin <hpa@zytor.com>2011-06-27 18:37:00 -0700
commitde86893bf5692743983420bad1a3b37fbb8dbdd2 (patch)
tree0efdcdb9b94ead1ce0fd60c8b4cb3b882543975f
parent822623d3583ac8a32c75f8fb98a1121c1d7a6c01 (diff)
downloadsyslinux-de86893bf5692743983420bad1a3b37fbb8dbdd2.tar.gz
syslinux-de86893bf5692743983420bad1a3b37fbb8dbdd2.tar.xz
syslinux-de86893bf5692743983420bad1a3b37fbb8dbdd2.zip
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@zytor.com>
-rw-r--r--core/debug.c7
-rw-r--r--core/extern.inc18
-rw-r--r--mk/syslinux.mk11
3 files changed, 32 insertions, 4 deletions
diff --git a/core/debug.c b/core/debug.c
new file mode 100644
index 00000000..28245736
--- /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 3858f709..802d72ab 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 6d87187f..5b7100f7 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