boot0 and boot0sio testers please...
Poul-Henning Kamp
phk at phk.freebsd.dk
Tue Apr 27 14:16:49 PDT 2004
(Ruslan is getting a repo copy done to get things done right,
so this file will change to boot0_512.S at some point)
This patch further reduces the diff between boot0 and boot0sio,
in particular the "Def:" becomes "Default:" in boot0sio as well.
A bug in boot0sio is fixed where we relied on %dx being retained
across a bios call and one in boot0 where we did not reset the
timer when the user typed a wrong key.
Please test
Poul-Henning
Index: boot0_512.s
===================================================================
RCS file: /home/ncvs/src/sys/boot/i386/boot0/boot0_512.s,v
retrieving revision 1.1
diff -u -r1.1 boot0_512.s
--- boot0_512.s 27 Apr 2004 19:07:35 -0000 1.1
+++ boot0_512.s 27 Apr 2004 21:11:59 -0000
@@ -98,12 +98,9 @@
// 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.
@@ -198,23 +195,21 @@
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 // error
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 */
//
// Busy loop, looking for keystrokes but
// keeping one eye on the time.
@@ -225,19 +220,14 @@
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.
@@ -245,18 +235,6 @@
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:
@@ -266,7 +244,7 @@
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.
@@ -389,15 +367,18 @@
movb $0xe,%ah // BIOS: Display
int $0x10 // character
popw %bx // Restore
+ retw // To caller
#else /* SIO */
-putchr: pushw %dx // Save
- xorw %dx,%dx // Use COM1
- xorw %cx,%cx // No timeout
+putchr:
movb $0x01,%ah // BIOS: Send
+ xorw %cx,%cx // No timeout
+bioscom:
+ pushw %dx // Save
+ xorw %dx,%dx // Use COM1
int $0x14 // Character
popw %dx // Restore
-#endif /* SIO */
retw // To caller
+#endif /* SIO */
// One-sector disk I/O routine
@@ -424,12 +405,11 @@
// Menu strings
-#ifndef SIO
item: .ascii " "; .byte ' '|0x80
+#ifndef SIO
prompt: .ascii "\nDefault:"; .byte ' '|0x80
#else /* SIO */
-item: .ascii " "; .byte ' '|0x80
-prompt: .ascii "\nDef:"; .byte ' '|0x80
+prompt: .ascii "\nDefault:"; .byte ' '|0x80
#endif /* SIO */
crlf: .ascii "\r"; .byte '\n'|0x80
--
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.
More information about the freebsd-current
mailing list