CVS commit: src/sys/arch/i386/stand/mbr

2024-06-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Jun 29 13:22:08 UTC 2024

Modified Files:
src/sys/arch/i386/stand/mbr: Makefile.mbr
Removed Files:
src/sys/arch/i386/stand/mbr: gpt.S
src/sys/arch/i386/stand/mbr/mbr_gpt: Makefile
src/sys/arch/i386/stand/mbr/mbr_gpt_com0: Makefile

Log Message:
i386: stand: G/C `mbr_gpt*`; unhooked since 2011 in prefer of `gptmbr`


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/stand/mbr/Makefile.mbr
cvs rdiff -u -r1.3 -r0 src/sys/arch/i386/stand/mbr/gpt.S
cvs rdiff -u -r1.1 -r0 src/sys/arch/i386/stand/mbr/mbr_gpt/Makefile
cvs rdiff -u -r1.1 -r0 src/sys/arch/i386/stand/mbr/mbr_gpt_com0/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/mbr

2024-06-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Jun 29 13:22:08 UTC 2024

Modified Files:
src/sys/arch/i386/stand/mbr: Makefile.mbr
Removed Files:
src/sys/arch/i386/stand/mbr: gpt.S
src/sys/arch/i386/stand/mbr/mbr_gpt: Makefile
src/sys/arch/i386/stand/mbr/mbr_gpt_com0: Makefile

Log Message:
i386: stand: G/C `mbr_gpt*`; unhooked since 2011 in prefer of `gptmbr`


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/stand/mbr/Makefile.mbr
cvs rdiff -u -r1.3 -r0 src/sys/arch/i386/stand/mbr/gpt.S
cvs rdiff -u -r1.1 -r0 src/sys/arch/i386/stand/mbr/mbr_gpt/Makefile
cvs rdiff -u -r1.1 -r0 src/sys/arch/i386/stand/mbr/mbr_gpt_com0/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/stand/mbr/Makefile.mbr
diff -u src/sys/arch/i386/stand/mbr/Makefile.mbr:1.21 src/sys/arch/i386/stand/mbr/Makefile.mbr:1.22
--- src/sys/arch/i386/stand/mbr/Makefile.mbr:1.21	Wed Jul 25 23:45:32 2018
+++ src/sys/arch/i386/stand/mbr/Makefile.mbr	Sat Jun 29 13:22:08 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.mbr,v 1.21 2018/07/25 23:45:32 kamil Exp $
+#	$NetBSD: Makefile.mbr,v 1.22 2024/06/29 13:22:08 rin Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -45,7 +45,6 @@ CLEANFILES+=	${PROG}.tmp
 LOADADDR=	0x8800
 
 AFLAGS.mbr.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
-AFLAGS.gpt.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
 
 ${PROG}: ${OBJS}
 	${_MKTARGET_LINK}



CVS commit: src/sys/arch/i386/stand/mbr

2018-06-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 12 21:35:17 UTC 2018

Modified Files:
src/sys/arch/i386/stand/mbr: Makefile.mbr

Log Message:
Set NOSANITIZER in i386 mbr files

This is required to build these files and keep then functional with
enabled MKSANITIZER.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/stand/mbr/Makefile.mbr

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/stand/mbr/Makefile.mbr
diff -u src/sys/arch/i386/stand/mbr/Makefile.mbr:1.19 src/sys/arch/i386/stand/mbr/Makefile.mbr:1.20
--- src/sys/arch/i386/stand/mbr/Makefile.mbr:1.19	Sun Jan 12 15:26:29 2014
+++ src/sys/arch/i386/stand/mbr/Makefile.mbr	Tue Jun 12 21:35:17 2018
@@ -1,7 +1,8 @@
-#	$NetBSD: Makefile.mbr,v 1.19 2014/01/12 15:26:29 tsutsui Exp $
+#	$NetBSD: Makefile.mbr,v 1.20 2018/06/12 21:35:17 kamil Exp $
 
 S=		${.CURDIR}/../../../../..
 
+NOSANITIZER=	# defined
 NOMAN=		# defined
 
 LIBCRT0=	# nothing



CVS commit: src/sys/arch/i386/stand/mbr

2018-06-12 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 12 21:35:17 UTC 2018

Modified Files:
src/sys/arch/i386/stand/mbr: Makefile.mbr

Log Message:
Set NOSANITIZER in i386 mbr files

This is required to build these files and keep then functional with
enabled MKSANITIZER.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/stand/mbr/Makefile.mbr

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/mbr

2018-05-19 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 19 18:19:37 UTC 2018

Modified Files:
src/sys/arch/i386/stand/mbr: gpt.S

Log Message:
Fix some whitespace style issues.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/mbr/gpt.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/stand/mbr/gpt.S
diff -u src/sys/arch/i386/stand/mbr/gpt.S:1.2 src/sys/arch/i386/stand/mbr/gpt.S:1.3
--- src/sys/arch/i386/stand/mbr/gpt.S:1.2	Sat May 19 18:18:16 2018
+++ src/sys/arch/i386/stand/mbr/gpt.S	Sat May 19 18:19:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: gpt.S,v 1.2 2018/05/19 18:18:16 jakllsch Exp $ */
+/*	$NetBSD: gpt.S,v 1.3 2018/05/19 18:19:37 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
  *
  * NO_LBA_CHECK	- no check if bios supports LBA reads
  * NO_CRC_CHECK	- disable crc checks for GPT
- * NO_BANNER- do not output title line 'banner'
+ * NO_BANNER	- do not output title line 'banner'
  */
 
 #ifdef COM_PORT
@@ -143,7 +143,7 @@ ENTRY(start)
 	mov	%ax, %es
 	mov	%ax, %ds
 	movw	$mbr, %di
-	mov $BOOTADDR + (mbr - start), %si
+	mov	$BOOTADDR + (mbr - start), %si
 	push	%ax			/* zero for %cs of lret */
 	push	%di
 	movw	$(bss_start - mbr), %cx



CVS commit: src/sys/arch/i386/stand/mbr

2018-05-19 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 19 18:19:37 UTC 2018

Modified Files:
src/sys/arch/i386/stand/mbr: gpt.S

Log Message:
Fix some whitespace style issues.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/mbr/gpt.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/mbr

2018-05-19 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 19 18:18:16 UTC 2018

Modified Files:
src/sys/arch/i386/stand/mbr: gpt.S

Log Message:
Compact crc32 code by 12 bytes of text.

>From dave0 in #NetBSD on Freenode circa December 2017.

Tested in a 32-bit userland harness to produce identical results as old
code for one set of inputs.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/mbr/gpt.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/stand/mbr/gpt.S
diff -u src/sys/arch/i386/stand/mbr/gpt.S:1.1 src/sys/arch/i386/stand/mbr/gpt.S:1.2
--- src/sys/arch/i386/stand/mbr/gpt.S:1.1	Thu Jan  6 01:08:49 2011
+++ src/sys/arch/i386/stand/mbr/gpt.S	Sat May 19 18:18:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: gpt.S,v 1.1 2011/01/06 01:08:49 jakllsch Exp $ */
+/*	$NetBSD: gpt.S,v 1.2 2018/05/19 18:18:16 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -428,21 +428,14 @@ message_1:
  * %ebx		crc (returned)
  */
 crc32:
-	push	%dx			/* preserve drive number */
-	push	%ax			/* preserve original CRC */
-
-	xorl	%ebx, %ebx
-	decl	%ebx			/* init value */
+	orl	 $-1, %ebx		/* init value */
 1:
-	lodsb/* load next message byte to %al */
+	xorb	(%si), %bl		/* xoring next message byte with previous result */
+	inc	%si
 	movb	$8, %cl			/* set bit counter */
 2:
-	movb	%al, %dl
-	xorb	%bl, %dl		/* xoring with previous result */
 	shrl	$1, %ebx
-	shrb	$1, %al
-	testb	$1, %dl
-	jz	3f
+	jnc	3f
 crc32_poly = . + 3			/* gross, but saves a few bytes */
 	xorl	$0xedb88320, %ebx	/* EFI CRC32 Polynomial */
 3:
@@ -451,8 +444,6 @@ crc32_poly = . + 3			/* gross, but saves
 	jne	1b
 	notl	%ebx			/* result correction */
 
-	pop	%ax
-	pop	%dx
 	ret
 #endif
 



CVS commit: src/sys/arch/i386/stand/mbr

2018-05-19 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 19 18:18:16 UTC 2018

Modified Files:
src/sys/arch/i386/stand/mbr: gpt.S

Log Message:
Compact crc32 code by 12 bytes of text.

>From dave0 in #NetBSD on Freenode circa December 2017.

Tested in a 32-bit userland harness to produce identical results as old
code for one set of inputs.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/mbr/gpt.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/mbr

2018-02-17 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Feb 17 13:54:52 UTC 2018

Modified Files:
src/sys/arch/i386/stand/mbr: gptmbr.S
src/sys/arch/i386/stand/mbr/gptmbr: Makefile

Log Message:
Drop explicit loop prefix. GAS doesn't care and LLVM doesn't support it.
Drop the need for assembling with GAS. While LLVM is using a suboptimal
encoding of for hard-coded memory writes, it shouldn't affect
functionality. It just wastes three bytes with extra prefixes.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/mbr/gptmbr.S
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/stand/mbr/gptmbr/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/stand/mbr/gptmbr.S
diff -u src/sys/arch/i386/stand/mbr/gptmbr.S:1.1 src/sys/arch/i386/stand/mbr/gptmbr.S:1.2
--- src/sys/arch/i386/stand/mbr/gptmbr.S:1.1	Wed Aug 17 00:25:05 2011
+++ src/sys/arch/i386/stand/mbr/gptmbr.S	Sat Feb 17 13:54:52 2018
@@ -160,7 +160,7 @@ next:
 get_ptab:
 	call	read_sector
 	call	inc64
-	loopw	get_ptab
+	loop	get_ptab
 
 	/* Find the boot partition */
 	xorw	%si,%si			/* Nothing found yet */
@@ -182,7 +182,7 @@ find_part:
 	movw	%di,%si
 not_this:
 	addw	%ax,%di
-	loopw	find_part
+	loop	find_part
 
 	andw	%si,%si
 	jnz	found_part

Index: src/sys/arch/i386/stand/mbr/gptmbr/Makefile
diff -u src/sys/arch/i386/stand/mbr/gptmbr/Makefile:1.3 src/sys/arch/i386/stand/mbr/gptmbr/Makefile:1.4
--- src/sys/arch/i386/stand/mbr/gptmbr/Makefile:1.3	Wed Sep 21 18:15:59 2011
+++ src/sys/arch/i386/stand/mbr/gptmbr/Makefile	Sat Feb 17 13:54:52 2018
@@ -1,10 +1,8 @@
-#	$NetBSD: Makefile,v 1.3 2011/09/21 18:15:59 jakllsch Exp $
+#	$NetBSD: Makefile,v 1.4 2018/02/17 13:54:52 joerg Exp $
 
 PROG=		gptmbr.bin
 SRCS=		gptmbr.S
 
-AFLAGS.gptmbr.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
-
 .include <../Makefile.mbr>
 
 LOADADDR=	0x600



CVS commit: src/sys/arch/i386/stand/mbr

2018-02-17 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Feb 17 13:54:52 UTC 2018

Modified Files:
src/sys/arch/i386/stand/mbr: gptmbr.S
src/sys/arch/i386/stand/mbr/gptmbr: Makefile

Log Message:
Drop explicit loop prefix. GAS doesn't care and LLVM doesn't support it.
Drop the need for assembling with GAS. While LLVM is using a suboptimal
encoding of for hard-coded memory writes, it shouldn't affect
functionality. It just wastes three bytes with extra prefixes.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/mbr/gptmbr.S
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/stand/mbr/gptmbr/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/mbr/gptmbr

2011-09-21 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Sep 21 18:15:59 UTC 2011

Modified Files:
src/sys/arch/i386/stand/mbr/gptmbr: Makefile

Log Message:
Set LOADADDR to 0x600, matches how gptmbr.bin is compiled upstream.
This should let this actually work.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/mbr/gptmbr/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/stand/mbr/gptmbr/Makefile
diff -u src/sys/arch/i386/stand/mbr/gptmbr/Makefile:1.2 src/sys/arch/i386/stand/mbr/gptmbr/Makefile:1.3
--- src/sys/arch/i386/stand/mbr/gptmbr/Makefile:1.2	Wed Aug 17 22:26:40 2011
+++ src/sys/arch/i386/stand/mbr/gptmbr/Makefile	Wed Sep 21 18:15:59 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2011/08/17 22:26:40 joerg Exp $
+#	$NetBSD: Makefile,v 1.3 2011/09/21 18:15:59 jakllsch Exp $
 
 PROG=		gptmbr.bin
 SRCS=		gptmbr.S
@@ -7,4 +7,4 @@
 
 .include ../Makefile.mbr
 
-LOADADDR=	0
+LOADADDR=	0x600



CVS commit: src/sys/arch/i386/stand/mbr/gptmbr

2011-09-21 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Sep 21 18:15:59 UTC 2011

Modified Files:
src/sys/arch/i386/stand/mbr/gptmbr: Makefile

Log Message:
Set LOADADDR to 0x600, matches how gptmbr.bin is compiled upstream.
This should let this actually work.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/mbr/gptmbr/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/mbr/gptmbr

2011-08-17 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Aug 17 22:26:40 UTC 2011

Modified Files:
src/sys/arch/i386/stand/mbr/gptmbr: Makefile

Log Message:
.code16 user, so disable integrated assembler with clang for now.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/mbr/gptmbr/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/stand/mbr/gptmbr/Makefile
diff -u src/sys/arch/i386/stand/mbr/gptmbr/Makefile:1.1 src/sys/arch/i386/stand/mbr/gptmbr/Makefile:1.2
--- src/sys/arch/i386/stand/mbr/gptmbr/Makefile:1.1	Wed Aug 17 00:25:05 2011
+++ src/sys/arch/i386/stand/mbr/gptmbr/Makefile	Wed Aug 17 22:26:40 2011
@@ -1,8 +1,10 @@
-#	$NetBSD: Makefile,v 1.1 2011/08/17 00:25:05 jakllsch Exp $
+#	$NetBSD: Makefile,v 1.2 2011/08/17 22:26:40 joerg Exp $
 
 PROG=		gptmbr.bin
 SRCS=		gptmbr.S
 
+AFLAGS.gptmbr.S= ${${ACTIVE_CC} == clang:?-no-integrated-as:}
+
 .include ../Makefile.mbr
 
 LOADADDR=	0



CVS commit: src/sys/arch/i386/stand/mbr/gptmbr

2011-08-17 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Aug 17 22:26:40 UTC 2011

Modified Files:
src/sys/arch/i386/stand/mbr/gptmbr: Makefile

Log Message:
.code16 user, so disable integrated assembler with clang for now.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/mbr/gptmbr/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/mbr

2011-08-16 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Aug 17 00:25:05 UTC 2011

Modified Files:
src/sys/arch/i386/stand/mbr: Makefile
Added Files:
src/sys/arch/i386/stand/mbr: gptmbr.S
src/sys/arch/i386/stand/mbr/gptmbr: Makefile

Log Message:
Add gptmbr from syslinux 4.04, with some local modifications to fit our mbr
build system and to be self contanined.

Also, unlink the old mbr_gpt from the build.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/stand/mbr/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/mbr/gptmbr.S
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/mbr/gptmbr/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/stand/mbr/Makefile
diff -u src/sys/arch/i386/stand/mbr/Makefile:1.3 src/sys/arch/i386/stand/mbr/Makefile:1.4
--- src/sys/arch/i386/stand/mbr/Makefile:1.3	Thu Jan  6 01:08:49 2011
+++ src/sys/arch/i386/stand/mbr/Makefile	Wed Aug 17 00:25:05 2011
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.3 2011/01/06 01:08:49 jakllsch Exp $
+#	$NetBSD: Makefile,v 1.4 2011/08/17 00:25:05 jakllsch Exp $
 
 SUBDIR=		mbr mbr_bootsel mbr_ext mbr_com0 mbr_com0_9600
-SUBDIR+=	mbr_gpt mbr_gpt_com0
+SUBDIR+=	gptmbr
 
 .include bsd.subdir.mk

Added files:

Index: src/sys/arch/i386/stand/mbr/gptmbr.S
diff -u /dev/null src/sys/arch/i386/stand/mbr/gptmbr.S:1.1
--- /dev/null	Wed Aug 17 00:25:05 2011
+++ src/sys/arch/i386/stand/mbr/gptmbr.S	Wed Aug 17 00:25:05 2011
@@ -0,0 +1,330 @@
+/* ---
+ *
+ *   Copyright 2007-2009 H. Peter Anvin - All Rights Reserved
+ *   Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
+ *
+ *   Permission is hereby granted, free of charge, to any person
+ *   obtaining a copy of this software and associated documentation
+ *   files (the Software), to deal in the Software without
+ *   restriction, including without limitation the rights to use,
+ *   copy, modify, merge, publish, distribute, sublicense, and/or
+ *   sell copies of the Software, and to permit persons to whom
+ *   the Software is furnished to do so, subject to the following
+ *   conditions:
+ *
+ *   The above copyright notice and this permission notice shall
+ *   be included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * --- */
+
+#include machine/asm.h
+#include sys/bootblock.h
+
+#ifdef CTRL_80
+	.macro ADJUST_DRIVE
+	testb	$0x04, BIOS_kbdflags
+	jz	1f
+	movb	$0x80, %dl
+1:
+	.endm
+#elif defined(FORCE_80)
+	.macro ADJUST_DRIVE
+	movb	$0x80, %dl
+	.endm
+#else
+	.macro ADJUST_DRIVE
+	.endm
+#endif
+
+	.code16
+	.text
+
+	.globl	bootsec
+stack		= 0x7c00
+
+/* Partition table header here */
+phdr		= stack		/* Above the stack, overwritten by bootsect */
+/* Partition table sector here */
+/* To handle  32K we need to play segment tricks... */
+psec		= _phdr + 512
+
+/* Where we put DS:SI */
+dssi_out	= start + 0x1be
+
+BIOS_kbdflags	= 0x417
+BIOS_page	= 0x462
+
+	/* gas/ld has issues with doing this as absolute addresses... */
+	.section .bootsec, a, @nobits
+	.globl	bootsec
+bootsec:
+	.space	512
+
+	.text
+	.globl	start
+start:
+	cli
+	xorw	%ax, %ax
+	movw	%ax, %ds
+	movw	%ax, %ss
+	movw	$stack, %sp
+	movw	%sp, %si
+	pushw	%es		/* 4(%bp) es:di - $PnP header */
+	pushw	%di		/* 2(%bp) */
+	movw	%ax, %es
+	sti
+	cld
+
+	/* Copy down to 0:0x600 */
+	movw	$start, %di
+	movw	$(512/2), %cx
+	rep; movsw
+
+	ljmpw	$0, $next
+next:
+
+	ADJUST_DRIVE
+	pushw	%dx		/* 0(%bp) = %dl - drive number */
+
+	/* Check to see if we have EBIOS */
+	pushw	%dx		/* drive number */
+	movb	$0x41, %ah	/* %al == 0 already */
+	movw	$0x55aa, %bx
+	xorw	%cx, %cx
+	xorb	%dh, %dh
+	stc
+	int	$0x13
+	jc	1f
+	cmpw	$0xaa55, %bx
+	jne	1f
+	shrw	%cx		/* Bit 0 = fixed disk subset */
+	jnc	1f
+
+	/* We have EBIOS; patch in the following code at
+	   read_sector_cbios: movb $0x42, %ah ;  jmp read_common */
+	movl	$0xeb42b4+((read_common-read_sector_cbios-4)  24), \
+		(read_sector_cbios)
+
+1:
+	popw	%dx
+
+	/* Get (C)HS geometry */
+	movb	$0x08, %ah
+	int	$0x13
+	andw	$0x3f, %cx	/* Sector count */
+	movw	%sp, %bp	/* %bp - frame pointer: LEAVE UNCHANGED */
+	pushw	%cx		/* -2(%bp) Save sectors on the stack */
+	movzbw	%dh, %ax	/* dh = max head */
+	incw	%ax		/* From 0-based max to count */
+	mulw	%cx		/* 

CVS commit: src/sys/arch/i386/stand/mbr

2011-08-16 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Aug 17 00:25:05 UTC 2011

Modified Files:
src/sys/arch/i386/stand/mbr: Makefile
Added Files:
src/sys/arch/i386/stand/mbr: gptmbr.S
src/sys/arch/i386/stand/mbr/gptmbr: Makefile

Log Message:
Add gptmbr from syslinux 4.04, with some local modifications to fit our mbr
build system and to be self contanined.

Also, unlink the old mbr_gpt from the build.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/stand/mbr/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/mbr/gptmbr.S
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/mbr/gptmbr/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/mbr

2011-05-20 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri May 20 15:05:02 UTC 2011

Modified Files:
src/sys/arch/i386/stand/mbr: Makefile.mbr

Log Message:
mbr.S and gpt.S want to reassign ., so don't use the integrated
assembler for now.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/i386/stand/mbr/Makefile.mbr

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/stand/mbr/Makefile.mbr
diff -u src/sys/arch/i386/stand/mbr/Makefile.mbr:1.17 src/sys/arch/i386/stand/mbr/Makefile.mbr:1.18
--- src/sys/arch/i386/stand/mbr/Makefile.mbr:1.17	Fri Nov 20 17:28:19 2009
+++ src/sys/arch/i386/stand/mbr/Makefile.mbr	Fri May 20 15:05:02 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.mbr,v 1.17 2009/11/20 17:28:19 dsl Exp $
+#	$NetBSD: Makefile.mbr,v 1.18 2011/05/20 15:05:02 joerg Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -41,6 +41,9 @@
 
 LOADADDR=	0x8800
 
+AFLAGS.mbr.S= ${${ACTIVE_CC} == clang:?-no-integrated-as:}
+AFLAGS.gpt.S= ${${ACTIVE_CC} == clang:?-no-integrated-as:}
+
 ${PROG}: ${OBJS}
 	${_MKTARGET_LINK}
 	${CC} -o ${PROG}.tmp ${LDFLAGS} -Wl,-Ttext,${LOADADDR} ${OBJS}



CVS commit: src/sys/arch/i386/stand/mbr

2011-05-20 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri May 20 15:05:02 UTC 2011

Modified Files:
src/sys/arch/i386/stand/mbr: Makefile.mbr

Log Message:
mbr.S and gpt.S want to reassign ., so don't use the integrated
assembler for now.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/i386/stand/mbr/Makefile.mbr

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/mbr

2010-12-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Dec  8 21:56:42 UTC 2010

Modified Files:
src/sys/arch/i386/stand/mbr: mbr.S

Log Message:
Remove now-incorrect detail about the link address from comment.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/i386/stand/mbr/mbr.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/stand/mbr/mbr.S
diff -u src/sys/arch/i386/stand/mbr/mbr.S:1.22 src/sys/arch/i386/stand/mbr/mbr.S:1.23
--- src/sys/arch/i386/stand/mbr/mbr.S:1.22	Thu Nov 19 22:10:03 2009
+++ src/sys/arch/i386/stand/mbr/mbr.S	Wed Dec  8 21:56:42 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbr.S,v 1.22 2009/11/19 22:10:03 dsl Exp $	*/
+/*	$NetBSD: mbr.S,v 1.23 2010/12/08 21:56:42 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1999-2004 The NetBSD Foundation, Inc. 
@@ -121,7 +121,7 @@
 	.code16
 /*
  * Move ourselves out of the way first.
- * (to the address we are linked at - 0x600)
+ * (to the address we are linked at)
  * and zero our bss
  */
 ENTRY(start)



CVS commit: src/sys/arch/i386/stand/mbr

2010-12-08 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Dec  8 21:56:42 UTC 2010

Modified Files:
src/sys/arch/i386/stand/mbr: mbr.S

Log Message:
Remove now-incorrect detail about the link address from comment.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/i386/stand/mbr/mbr.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/i386/stand/mbr

2009-11-18 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Wed Nov 18 20:51:22 UTC 2009

Modified Files:
src/sys/arch/i386/stand/mbr: mbr.S

Log Message:
Adjust the way references to the unrelocated addresses are done so
that the address doesn't have to be passed in.
Adjust #ifdef so that only one item is checked - at it is the one used.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/stand/mbr/mbr.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/stand/mbr/mbr.S
diff -u src/sys/arch/i386/stand/mbr/mbr.S:1.20 src/sys/arch/i386/stand/mbr/mbr.S:1.21
--- src/sys/arch/i386/stand/mbr/mbr.S:1.20	Fri Nov 28 18:18:16 2008
+++ src/sys/arch/i386/stand/mbr/mbr.S	Wed Nov 18 20:51:22 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbr.S,v 1.20 2008/11/28 18:18:16 dsl Exp $	*/
+/*	$NetBSD: mbr.S,v 1.21 2009/11/18 20:51:22 dsl Exp $	*/
 
 /*
  * Copyright (c) 1999-2004 The NetBSD Foundation, Inc. 
@@ -63,6 +63,8 @@
 #if !defined(COM_FREQ)
 #define COM_FREQ 1843200
 #endif
+#else
+#undef COM_BAUD
 #endif
 
 #ifdef BOOTSEL
@@ -72,8 +74,7 @@
 #include machine/asm.h
 #include sys/bootblock.h
 
-#define BOOTADDR	0x7c00
-#define LOADADDR	0x0600		/* address were are linked to */
+#define BOOTADDR	0x7c00		/* where we get loaded to */
 
 #define TABENTRYSIZE	(MBR_BS_PARTNAMESIZE + 1)
 #define NAMETABSIZE	(MBR_PART_COUNT * TABENTRYSIZE)
@@ -130,7 +131,7 @@
 	mov	%ax, %es
 	mov	%ax, %ds
 	movw	$mbr, %di
-	mov $mbr - LOADADDR + BOOTADDR, %si
+	mov $BOOTADDR + (mbr - start), %si
 	push	%ax			/* zero for %cs of lret */
 	push	%di
 	movw	$(bss_start - mbr), %cx
@@ -153,7 +154,7 @@
 	push	%dx			/* save drive number */
 	push	%dx			/* twice - for err_msg loop */
 
-#if defined(COM_PORT)  defined(COM_BAUD)
+#if defined(COM_BAUD)
 	mov	$com_args, %si
 	mov	$num_com_args, %cl	/* %ch is zero from above */
 	mov	COM_PORT_VAL, %dx
@@ -258,7 +259,7 @@
 	pop	%dx			/* recover drive # */
 	push	%dx			/* save drive */
 	int	$0x13
-	movw	$nametab - LOADADDR + BOOTADDR, %bx
+	movw	$BOOTADDR + (nametab - start), %bx
 	jnc	next_extended		/* abort menu on read fail */
 #endif
 
@@ -284,7 +285,7 @@
 	int	$0x1a
 	mov	%dx, %di		/* start time to di */
 3:
-#ifdef COM_PORT
+#ifdef COM_PORT_VAL
 	mov	COM_PORT_VAL, %dx
 	push	%dx
 	add	$5, %dx
@@ -391,7 +392,7 @@
 	pop	%dx			/* original drive number */
 	push	%dx
 	push	%dx
-#ifdef COM_PORT
+#ifdef COM_PORT_VAL
 	jmp	wait_key		/* Read with timeout (again) */
 #else
 	jmp	get_key			/* Blocking read */
@@ -514,7 +515,7 @@
 */
 	movl	%ebp, %esi
 	pop	%dx			/* recover drive # */
-	jmp	start - LOADADDR + BOOTADDR
+	jmp	BOOTADDR
 
 
 #ifndef NO_CHS
@@ -552,7 +553,7 @@
 
 #ifndef NO_BANNER
 #ifdef BOOTSEL
-#ifdef COM_PORT
+#ifdef COM_PORT_VAL
 banner:	.asciz	a: disk
 #else
 banner:	.asciz	Fn: diskn
@@ -578,7 +579,7 @@
 #endif
 #endif
 
-#if defined(COM_PORT)  defined(COM_BAUD)
+#if defined(COM_BAUD)
 #define COM_DIVISOR (((COM_FREQ / COM_BAUD) + 8) / 16)
 com_args:
 	.byte	0x80			/* divisor latch enable */
@@ -601,7 +602,7 @@
 message_crlf:
 	call	message
 	movw	$crlf, %si
-#ifdef COM_PORT
+#ifdef COM_PORT_VAL
 message:
 	pusha
 message_1:



CVS commit: src/sys/arch/i386/stand/mbr/mbr

2009-11-18 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Wed Nov 18 21:04:12 UTC 2009

Modified Files:
src/sys/arch/i386/stand/mbr/mbr: Makefile

Log Message:
Reinstate the banner.
This was added to detect problems when the mbr code gets written into the pbr.
(When the code loops reading the pbr!)
It is also a useful diagnosting that the boot it proceeding normally.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/mbr/mbr/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/stand/mbr/mbr/Makefile
diff -u src/sys/arch/i386/stand/mbr/mbr/Makefile:1.2 src/sys/arch/i386/stand/mbr/mbr/Makefile:1.3
--- src/sys/arch/i386/stand/mbr/mbr/Makefile:1.2	Wed Apr 30 16:18:26 2008
+++ src/sys/arch/i386/stand/mbr/mbr/Makefile	Wed Nov 18 21:04:12 2009
@@ -1,6 +1,5 @@
-#	$NetBSD: Makefile,v 1.2 2008/04/30 16:18:26 ad Exp $
+#	$NetBSD: Makefile,v 1.3 2009/11/18 21:04:12 dsl Exp $
 
 PROG= mbr
-CPPFLAGS+=	-DNO_BANNER
 
 .include ../Makefile.mbr