i386/148509: Improvements to i386/boot2's comments

Ali Mashtizadeh mashtizadeh at gmail.com
Mon Jul 12 03:40:06 UTC 2010


>Number:         148509
>Category:       i386
>Synopsis:       Improvements to i386/boot2's comments
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-i386
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 12 03:40:06 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Ali Mashtizadeh
>Release:        FreeBSD Current
>Organization:
>Environment:
N/A
>Description:
This change improves some of the comments in the boot2 code.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: sys/boot/i386/boot2/boot1.S
===================================================================
--- sys/boot/i386/boot2/boot1.S	(revision 209923)
+++ sys/boot/i386/boot2/boot1.S	(working copy)
@@ -63,7 +63,7 @@
 
 		.org 0x0b, 0x00
 bpb:		.word   512		# sector size (T)
-		.byte	0		# sectors/clustor
+		.byte	0		# sectors/cluster
 		.word	0		# reserved sectors
 		.byte	0		# number of FATs
 		.word	0		# root entries
@@ -171,16 +171,19 @@
 /*
  * Ok, we have a slice and drive in %dx now, so use that to locate and load
  * boot2.  %si references the start of the slice we are looking for, so go
- * ahead and load up the first 16 sectors (boot1 + boot2) from that.  When
- * we read it in, we conveniently use 0x8c00 as our transfer buffer.  Thus,
- * boot1 ends up at 0x8c00, and boot2 starts at 0x8c00 + 0x200 = 0x8e00.
+ * ahead and load up the first NSECT (16) sectors (boot1 + boot2) from that.
+ *
+ * When we read it in, we conveniently use MEM_BUF (0x8c00) as our transfer
+ * buffer.  Thus, boot1 ends up at 0x8c00, and boot2 starts at 0x8c00 + 0x200
+ * = 0x8e00.
+ *
  * The first part of boot2 is the disklabel, which is 0x200 bytes long.
- * The second part is BTX, which is thus loaded into 0x9000, which is where
- * it also runs from.  The boot2.bin binary starts right after the end of
- * BTX, so we have to figure out where the start of it is and then move the
- * binary to 0xc000.  Normally, BTX clients start at MEM_USR, or 0xa000, but
- * when we use btxld to create boot2, we use an entry point of 0x2000.  That
- * entry point is relative to MEM_USR; thus boot2.bin starts at 0xc000.
+ * The second part is BTX, which is thus loaded into MEM_BTX (0x9000), which
+ * is where it also runs from.  The boot2.bin binary starts right after the
+ * end of BTX, so we have to figure out where the start of it is and then move
+ * the binary to 0xc000.  Normally, BTX clients start at MEM_USR, or 0xa000,
+ * but when we use btxld to create boot2, we use an entry point of 0x2000.
+ * That entry point is relative to MEM_USR; thus boot2.bin starts at 0xc000.
  */
 main.5: 	mov %dx,MEM_ARG			# Save args
 		movb $NSECT,%dh			# Sector count
@@ -265,7 +268,7 @@
  * fetch the drive parameters from the BIOS and divide it out ourselves.
  * Call with:
  *
- * %dl	- byte     - drive number
+ * %dl   - byte     - drive number
  * stack - 10 bytes - EDD Packet
  */
 read:		testb $FL_PACKET,%cs:MEM_REL+flags-start # LBA support enabled?
@@ -359,8 +362,14 @@
 
 		.org PRT_OFF,0x90
 
-/* Partition table */
 
+/*
+ * Partition table
+ *
+ * This partition table is used when the boot code is installed onto a raw
+ * disk rather than a slice of a disklabel.
+ */
+
 		.fill 0x30,0x1,0x0
 part4:		.byte 0x80, 0x00, 0x01, 0x00
 		.byte 0xa5, 0xfe, 0xff, 0xff
Index: sys/boot/i386/boot2/Makefile
===================================================================
--- sys/boot/i386/boot2/Makefile	(revision 209923)
+++ sys/boot/i386/boot2/Makefile	(working copy)
@@ -7,10 +7,14 @@
 # A value of 0x80 enables LBA support.
 BOOT_BOOT1_FLAGS?=	0x80
 
+# COM1, 9600 buad, 8N1, No Parity
 BOOT_COMCONSOLE_PORT?= 0x3f8
 BOOT_COMCONSOLE_SPEED?= 9600
 B2SIOFMT?=	0x3
 
+# These hard coded values used by the linker match the values found in boot1.S
+# REL1 is equivalent to MEM_REL which is where boot1.S will relocate itself.
+# ORG1 is equivalent to MEM_ORG.
 REL1=	0x700
 ORG1=	0x7c00
 ORG2=	0x2000


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-i386 mailing list