Toshiba Tecra 710CDT bzImage boot problems
	==========================================

    Linux is a complete, free Unix-like operating system.  Read
http://www.li.org/Introduction/Welcome.html for more information about
Linux.  The kernel source code is available for download at
ftp://ftp.funet.fi/pub/Linux/kernel/linux/v2.0/ and many other
anonymous ftp sites around the world.  Files referenced in this text
are to be found in the kernel source code archive.

    For booting the kernel, there is a choice of different types of
bootloaders, which install into the boot sector or master boot record
(MBR) of a hard disk (LILO), load directly from a raw floppy disk, or
load from DOS (loadlin), The two former ones have options to either
load the binary kernel image into low memory (<640K, "zImage type") or
into high memory (>1MB, "bzImage type").  The former limits the
maximum kernel size to about 500 KB, thereby reducing the number of
possible compiled-in device drivers.

    Booting the latter bzImage type kernels from either LILO or a raw
floppy disk fails on certain hardware platforms.  On a Toshiba Tecra
710CDT laptop computer (see http://www.cck.uni-kl.de/misc/tecra710/
for further info), the computer is reset when executing the first
instructions after switching to protected mode.


    I have analyzed the problem extensively and can point to the
apparent cause of the problem. 


Booting the kernel
------------------

    This section details the major steps taken from when the binary
kernel image is loaded into the computer's main memory to when it
switches the processor to protected mode.  This is shown for the raw
floppy boot case, because it is the simplest to show the problem.  The
relevant code is in the files arch/i386/boot/{bootsect,setup}.S, this
code then jumps to the first instruction in
arch/i386/boot/compressed/head.S, which contains the beginning of the
protected mode instructions.  The bootsector loads the code in
compressed/head.S into high memory (>1MB).

bootsect.S (the bootsector):
 - loads the rest of the setup code
 - determines the floppy disk configuration
 - loads the binary kernel image file using BIOS INT 0x13 and moves it
   into high memory using BIOS INT  0x15 function 0x87 (64 KB chunks).
 - jumps to the beginning of setup.S

setup.S (real-mode setup):
 - gets the memory size (BIOS int 0x15 function 0x88)
 - sets the keyboard repeat rate
 - reads the hard drive configuration data from the BIOS data area
 - checks for a PS/2 mouse
 - checks for power management (APM)
 - disables interrupts and NMIs
 - loads the IDT and GDT
 - enables the A20 gate
 - resets the math coprocessor
 - reprograms the interrupt controller
 - switches the processor to protected mode
 - performs a far jump to the beginning of the 32bit code in
   compressed/head.S, which is at 0x100000.
 - at this point, on a Toshiba Tecra 710CDT, the computer does
   a hard power-on reset and reboots.


Cause
-----

    Instructions in arch/i386/boot/compressed/head.S and the rest of
the kernel are loaded into high memory (0x100000 and above) by the
bootsector and setup code (arch/i386/boot/{bootsect,setup}.S) using
BIOS INT 15 function 0x87. Just before switching the processor to
Protected Mode, the A20 gate is enabled and then, a JMP FAR to
0x100000 occurs.

    On the Toshiba laptop, the first two bytes there are incorrect and
identical to those from address 0x000000 (which was an alias for
0x100000 before the A20 gate enable). At a second read from 0x100000
immediately afterwards, the correct memory content is returned.

    Asus P55TP5XE boards (Triton I chipset) show quite the same
problem, but there, only the first byte is incorrect and booting
bzImage kernels works fine.

    To me, this looks like some buffer or cache coherency problem,
although I think that caches are organized in at least 16 byte cache
lines. Any pointers to the real cause in the design of the
microprocessor and/or the PCI mainboard chipset are very welcome.


References
----------

	Linux on the Toshiba Tecra 710CDT laptop WWW page at
		http://www.cck.uni-kl.de/misc/tecra710/


Jens Maurer  12 Sep 1996