[REVIEW/TEST] boot0 changes

From: Poul-Henning Kamp <phk_at_phk.freebsd.dk>
Date: Thu, 03 Jun 2004 17:52:33 +0200
Ok, now that the dust has settled, I try again.

Can people please test/review these changes to boot0.  They
merge closer the SIO and video versions of boot0.

Thanks in advance.


Index: boot0.S
===================================================================
RCS file: /home/ncvs/src/sys/boot/i386/boot0/boot0.S,v
retrieving revision 1.8
diff -u -r1.8 boot0.S
--- boot0.S	14 May 2004 20:28:31 -0000	1.8
+++ boot0.S	3 Jun 2004 15:48:22 -0000
_at__at_ -95,14 +95,10 _at__at_
 #ifdef SIO
 /*
  * Initialize the serial port.
- * Must save DX (contains drive number)
  */
-		pushw %dx			# Save
-		xorw %dx,%dx			# Port: COM1
 		movb COMSPEED,%al		# defined by Makefile
 		movb $0x00,%ah			# BIOS: Set COM Port
-		int $0x14			#  Parameters
-		popw %dx			# Restore
+		call bioscom
 #endif /* SIO */
 /*
  * Check what flags were loaded with us, specifically, Use a predefined Drive.
_at__at_ -199,23 +195,21 _at__at_
 		callw putx			#  item
 /*
  * Now that we've printed the drive (if we needed to), display a prompt.
- * Get ready for the input by noting the time.
  */
 main.7:		movw $prompt,%si		# Display
 		callw putstr			#  prompt
 		movb _OPT(%bp),%dl		# Display
 		decw %si			#  default
 		callw putkey			#  key
-main.7_1:
+/*
+ * Start of input loop.  Beep and take note of time
+ */
+main.10:	movb $ASCII_BEL,%al		# Signal
+		callw putchr			#  beep!
 		xorb %ah,%ah			# BIOS: Get
 		int $0x1a			#  system time
-#ifndef SIO
 		movw %dx,%di			# Ticks when
-		addw _TICKS(%bp),%di	 	#  timeout
-#else /* SIO */
-		movw %dx,%si			# Ticks when
-		addw _TICKS(%bp),%si		#  timeout
-#endif /* SIO */
+		addw _TICKS(%bp),%di		#  timeout
 /*
  * Busy loop, looking for keystrokes but
  * keeping one eye on the time.
_at__at_ -226,19 +220,14 _at__at_
 		int $0x16			#  for keypress
 		jnz main.11			# Have one
 #else /* SIO */
-		xorw %dx,%dx			# Use COM1
 		movb $0x03,%ah			# BIOS: Read COM
-		int $0x14			#  Status
+		call bioscom
 		testb $0x01,%ah			# Check line status
 		jnz main.11 			# (bit 1 indicates input)
 #endif /* SIO */
 		xorb %ah,%ah			# BIOS: Get
 		int $0x1a			#  system time
-#ifndef SIO
 		cmpw %di,%dx			# Timeout?
-#else /* SIO */
-		cmpw %si,%dx			# Timeout?
-#endif /* SIO */
 		jb main.8			# No
 /*
  * If timed out or defaulting, come here.
_at__at_ -246,18 +235,6 _at__at_
 main.9:		movb _OPT(%bp),%al		# Load default
 		jmp main.12			# Join common code
 /*
- * User's last try was bad, beep in displeasure.
- * Since nothing was printed, just continue on as if the user
- * hadn't done anything. This gives the effect of the user getting a beep
- * for all bad keystrokes but no action until either the timeout
- * occurs or the user hits a good key.
- */
-main.10:	movb $ASCII_BEL,%al		# Signal
-		callw putchr			#  error
-#ifdef SIO
-		jmp main.7_1			# Go back
-#endif /* SIO */
-/*
  * Get the keystroke.
  */
 main.11:
_at__at_ -267,7 +244,7 _at__at_
 		movb %ah,%al			# Scan code
 #else /* SIO */
 		movb $0x02,%ah			# BIOS: Receive
-		int $0x14			#  COM Byte
+		call bioscom
 #endif /* SIO */
 /*
  * If it's CR act as if timed out.
_at__at_ -384,22 +361,25 _at__at_
 		jmp putstr			# Continue
 putstr.2:	andb $~0x80,%al 		# Clear MSB
 
-putchr:
 #ifndef SIO
+putchr:
 		pushw %bx			# Save
 		movw $0x7,%bx	 		# Page:attribute
 		movb $0xe,%ah			# BIOS: Display
 		int $0x10			#  character
 		popw %bx			# Restore
+		retw				# To caller
 #else /* SIO */
+putchr:
+		movb $0x01,%ah			# BIOS: Send
+		xorw %cx,%cx 			# No timeout
+bioscom:
 		pushw %dx			# Save
 		xorw %dx,%dx 			# Use COM1
-		xorw %cx,%cx 			# No timeout
-		movb $0x01,%ah			# BIOS: Send
 		int $0x14			#  Character
 		popw %dx			# Restore
-#endif /* SIO */
 		retw				# To caller
+#endif /* SIO */
 
 /* One-sector disk I/O routine */
 
_at__at_ -426,13 +406,8 _at__at_
 
 /* Menu strings */
 
-#ifndef SIO
 item:		.ascii "  ";	     .byte ' '|0x80
 prompt:		.ascii "\nDefault:"; .byte ' '|0x80
-#else /* SIO */
-item:		.ascii " ";	     .byte ' '|0x80
-prompt:		.ascii "\nDef:";     .byte ' '|0x80
-#endif /* SIO */
 crlf:		.ascii "\r";	     .byte '\n'|0x80
 
 /* Partition type tables */
-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk_at_FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
Received on Thu Jun 03 2004 - 06:52:37 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:55 UTC