[syslinux] Patch: make slightly more verbose versions of isohdp.x.S

Martin Str|mberg ams at ludd.ltu.se
Mon Mar 20 23:43:41 PDT 2017


From: MartinS <ams at ludd.ltu.se>

isohdp[fp]v.S which says E or C if EBIOS or CBIOS is used. isohdppv.S
also says G or M if a GPT or MBR partition is detected.

Signed-off-by: MartinS <ams at ludd.ltu.se>
---
Comments?


diff --git a/mbr/Makefile b/mbr/Makefile
index be2bded..7095396 100644
--- a/mbr/Makefile
+++ b/mbr/Makefile
@@ -21,7 +21,8 @@ include $(MAKEDIR)/embedded.mk
 
 all:	mbr.bin   altmbr.bin   gptmbr.bin   isohdpfx.bin   isohdppx.bin \
 	mbr_c.bin altmbr_c.bin gptmbr_c.bin isohdpfx_c.bin isohdppx_c.bin \
-	mbr_f.bin altmbr_f.bin gptmbr_f.bin isohdpfx_f.bin isohdppx_f.bin
+	mbr_f.bin altmbr_f.bin gptmbr_f.bin isohdpfx_f.bin isohdppx_f.bin \
+	isohdpfv.bin isohdppv.bin
 
 %.o: %.S
 	$(CC) $(MAKEDEPS) $(SFLAGS) -Wa,-a=$*.lst -c -o $@ $<
diff --git a/mbr/checksize.pl b/mbr/checksize.pl
index 4b42327..1fb2a86 100755
--- a/mbr/checksize.pl
+++ b/mbr/checksize.pl
@@ -27,7 +27,7 @@ if (!defined($maxsize)) {
 	$maxsize = $padsize = 440;
     } elsif ($file =~ /^gptmbr[^0-9a-z]/) {
 	$maxsize = $padsize = 440;
-    } elsif ($file =~ /^isohdp[fp]x[^0-9a-z]/) {
+    } elsif ($file =~ /^isohdp[fp][vx][^0-9a-z]/) {
 	$maxsize = $padsize = 432;
     } elsif ($file =~ /^altmbr[^0-9a-z]/) {
 	$maxsize = $padsize = 439;
diff --git a/mbr/isohdpfv.S b/mbr/isohdpfv.S
new file mode 100644
index 0000000..46c9c07
--- /dev/null
+++ b/mbr/isohdpfv.S
@@ -0,0 +1,3 @@
+#define DEBUG_PRINT 1
+#include "isohdpfx.S"
+	
diff --git a/mbr/isohdpfx.S b/mbr/isohdpfx.S
index 17e1efe..6d8ab36 100644
--- a/mbr/isohdpfx.S
+++ b/mbr/isohdpfx.S
@@ -121,10 +121,24 @@ _start:
 	/* We have GPT partition information */
 	movl	(32+20)(%si), %ecx
 	movl	(36+20)(%si), %ebx
+
+#ifdef DEBUG_PRINT
+	push	%si
+	call	print_string
+	.ascii	"G\r\n"
+	pop	%si
+#endif
 	jmp	1f
 
 	/* We have non-GPT partition information */
 2:
+#ifdef DEBUG_PRINT
+	push	%si
+	call	print_string
+	.ascii	"M\r\n"
+	pop	%si
+#endif
+
 	movl	8(%si), %ecx
 #endif
 1:
@@ -167,14 +181,34 @@ next:
 	   read_sector_cbios: movb $0x42, %ah ;  jmp read_common */
 	movl	$0xeb42b4+((read_common-read_sector_cbios-4) << 24), \
 		(read_sector_cbios)
-	jmp	1f
+
+#ifdef	DEBUG_PRINT
+	push	%si
+	call	print_string
+	.ascii	"E\r\n"
+	jmp	2f
 1:
+	push	%si
+	call	print_string
+	.ascii	"C\r\n"
+2:
+	call	print_string
+	.ascii	"Key?\r\n"
+	pop	%si
+	xor	%ax, %ax
+	int	$0x16
+#else
+1:	
+#endif
+
 	popw	%dx
 	pushw	%cx		/* EBIOS flag */
 
 	/* Get (C)HS geometry */
 	movb	$0x08, %ah
 	int	$0x13
+	
+	/* here we computer CHS values or just do some dummy computation for EBIOS */
 	andw	$0x3f, %cx	/* Sector count */
 	popw	%bx		/* EBIOS flag */
 	pushw	%cx		/* -16: Save sectors on the stack */
@@ -223,9 +257,15 @@ next:
 	ljmpw	$0, $isolinux_start_hybrid
 
 bad_signature:
-	call	error
+	call	print_string
 	.ascii	"isolinux.bin missing or corrupt.\r\n"
 
+boot_failure:
+	int	$0x18		/* Boot failure */
+die:
+	hlt
+	jmp	die
+
 /*
  * read_sector: read a single sector pointed to by %eax to %es:%bx.
  * CF is set on error.  All registers saved.
@@ -266,15 +306,20 @@ read_common:
 	ret
 
 disk_error:
-	call	error
+	call	print_string
 	.ascii	"Operating system load error.\r\n"
+	jmp	boot_failure
 
-/*
- * Print error messages.  This is invoked with "call", with the
- * error message at the return address.
+/* 
+ * Print message. This is invoked with "call", with the message at the
+ * return address.
+ * Destroys SI.
  */
-error:
-	popw	%si
+print_string:
+	pop	%si
+	push	%bp
+	push	%ax
+	push	%bx
 2:
 	lodsb
 	movb	$0x0e, %ah
@@ -284,10 +329,11 @@ error:
 	cmpb	$10, %al	/* Newline? */
 	jne	2b
 
-	int	$0x18		/* Boot failure */
-die:
-	hlt
-	jmp	die
-
+	pop	%bx
+	pop	%ax
+	pop	%bp
+	push	%si
+	ret
+	
 	/* Address of pointer to isolinux.bin */
 lba_offset = _start+432
diff --git a/mbr/isohdppv.S b/mbr/isohdppv.S
new file mode 100644
index 0000000..08f3881
--- /dev/null
+++ b/mbr/isohdppv.S
@@ -0,0 +1,3 @@
+#define DEBUG_PRINT 1
+#include "isohdppx.S"
+	




More information about the Syslinux mailing list