Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > by-pkgid > 9674c469565b0ff2e0711f363092e888 > files > 10

extipl-5.04-14mdv2010.0.i586.rpm

technical.txt

			 October 21, 2000

			takamiti@tsden.org
			 extipl@tsden.org
		http://www.tsden.org/takamiti/extipl/
(translation into English by Ryutaroh Matsumoto <ryutaroh@tsden.org>)

==============================================================================

1. Introduction
This document explains the OS loader called Scorpius (source file:
antares.asm) in extipl. It was the unique default loader in extipl
version 4, but is not installed by extipl 5 unless specified
explicitely. All other loaders in extipl 5 evolved from Scorpius, and
I think this document is useful for understanding any loader in extipl 
5.

4.1 Memory Map of an IPL
In booting procedure of IBM PC/AT compatibles, BIOS loads MBR to address
0x07c00 and executes it. Scorpius relocates itself to 0x0600 and starts
its job. After relocation, memory map becomes as follows.

        |                      |
	^                      ^
	|----------------------|
        |                      |
	|     512 bytes        | <- Scorpius loads first 512 bytes of the
        |                      |    booting partition here. Scorpius was also
        |		       |    loaded here initially.
0x07C00 +======================+ <- upper bound of Extended-IPL stack
	|                      |             (SP register is set to 0x07c000)
	^                      ^
	|------------------55AA| <- partition validity indicator 0xAA55
0x007BE |______64_bytes________| <- partition table
        |                      |
	|     446 bytes        | <- code and data of Scorpius
	|                      |
0x00600 +======================+
        |                      |
	^                      ^
        |                      |
	|                      | <- interrupt vector and system reserved region
	|                      |
0x00000 +----------------------+
/////////////////////////////////////////////////////////////////////////

4.2 What Scorpius is Doing

After Scorpius relocates itself to 0x0600, it does the following steps.

(1) See if the shift key is pressed until floppy drive motor is turned off.
    If shift key is pressed, go to (3).
(2) Search a partition marked active. If it is found and has partition validity
    indicator 0xaa55, go to (4.5). If the active partition does not have 0xaa55,
    it makes beep sound and go to (3).
(3) Display partition table and "Boot#h:d.p", which indicates that the
    partition `p' in the depth `d' in the harddisk `h' is selected.
(4) Wait for keyboard input. Check pressed key in the following steps.
(4.1) If key is "0", "1", "2", "3" or "4", update and display selected
      partition number and return to (4).
(4.2) If key is neither <Enter> nor <End>, make beep sound
      and return to (4).
(4.3) If the selected number is "0", load first 512 bytes of next HD to
      0x07c000, copy partition table to 0x07be, and go to (3).
(4.4) If the selected partition is an empty partition, make beep sound and
      return to (4).
(4.5) If the selected partition is an extended partition, load first
      512 bytes of the extended partition to 0x07c000, copy the partition
      table to 0x07be, increase the depth, redisplay the prompt,
       and go to (3).
(4.6) Load first 512 bytes of selected partition to 0x7c00.
	(a) If key is <Enter> or it comes from (2), check 0xaa55 and go to (5).
	(b) If key is <End>, check 0xaa55, mark selected partition
	    bootable only if the selected partition is a primary
	    partition in the first HD, and go to (5).
(5) Execute the OS specific loader in first 512 bytes in selected partition by
    jumpping to 0x7c00. Each register has following content.
        ax, bx, cx, dh, di, bp: undefined.
	dl = BIOS drive number of OS specific loader (0x80, 0x81, ...)
    	ds = data segment of Scorpius (0x0)
    	si = relative address of selected partition information. Let n be
    	     the selected partition number, then value of si is
    	     	si = 0x07be + 16 * (n - 1).
    	     OS specific loader can get its partition information from address
    	     indicated by ds:si. Scorpius sets bootable flag in partition 
    	     information at address ds:si.
	(note: In IBM technical information, only value of ds:si is specified.)

4.3 How Scorpius boots OS on non-1st hard disk

In this section we explain how Scorpius passes the drive number to 
OS specific loader.

A partition table is equivalent to the following structure.

	    typedef unsigned char byte;

	    typedef struct {
		byte head;
		byte sector;
		byte cyl;
	    } hd_addr;

	    typedef struct {
		byte		bootind;	<<--- active flag
		hd_addr		start;
		byte		systemind;
		hd_addr		end;
		unsigned long	start_sector;
		unsigned long	nr_sectors;
	    } partition;

If partition.bootind is 0x80, its partition is marked bootable. If it is
0x00, its partition is marked not bootable. If HD unit number is n,
Extended-IPL sets partition.bootind to 0x80 + n, then execute OS specific
loader. Thus OS specific loader can know which HD unit it resides as
the value partition.bootind & 0x7f.