From 6ffbc2b68c34c2d1e42d5f6bcd8f2b94b82d05d7 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 3 Dec 2008 21:56:59 -0800 Subject: [PATCH] Avoid long pauses on serial timeout on boot on physical hardware. The Pintos loader writes status to the serial port as well as the VGA console, but this doesn't work out so well on at least some real hardware when nothing is connected to the serial port: each character can take a second or so to display because the BIOS waits for a serial timeout each time. So, on the first serial timeout, replace the "int $0x14" call by a pair of no-ops. The rest of the changes are part of the struggle not to exceed the maximum loader size. --- src/threads/loader.S | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/threads/loader.S b/src/threads/loader.S index a5819dd..dd87ea1 100644 --- a/src/threads/loader.S +++ b/src/threads/loader.S @@ -29,11 +29,12 @@ # Configure serial port so we can report progress without connected VGA. # See [IntrList] for details. sub %dx, %dx # Serial port 0. - mov $0x00e3, %ax # 9600 bps, N-8-1. + mov $0xe3, %al # 9600 bps, N-8-1. + # AH is already 0 (Initialize Port). int $0x14 # Destroys AX. call puts - .string "Pintos loader" + .string "PiLo" #### Read the partition table on each system hard disk and scan for a #### partition of type 0x20, which is the type that we use for a @@ -209,8 +210,12 @@ putc: pusha mov $0x01, %ah # Serial port output service. sub %dx, %dx # Serial port 0. - int $0x14 # Destroys AH. +2: int $0x14 # Destroys AH. + test $0x80, %ah # Output timed out? + jz 3f + movw $0x9090, 2b # Turn "int $0x14" above into NOPs. +3: cmp $'\r', %al jne popa_ret mov $'\n', %al @@ -224,8 +229,9 @@ putc: pusha read_sector: pusha - sub %eax, %eax - push %eax # LBA sector number [32:63] + sub %ax, %ax + push %ax # LBA sector number [48:63] + push %ax # LBA sector number [32:47] push %ebx # LBA sector number [0:31] push %es # Buffer segment push %ax # Buffer offset (always 0) -- 2.30.2