DOC PREVIEW
USF CS 686 - LECTURE NOTES

This preview shows page 1-2-24-25 out of 25 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 25 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

What is ‘bootstrapping’?Serious Pentium explorationsOur classroom setupSlide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11BIOS Disk Drive ServicesPhoenix Technologies LtdEDD Disk-Address PacketThe MBR parametersHow we search the Partition TableInstructions we could use‘Extended’ partitionsThe Linux schemeOur ‘cs686ipl.s’ boot-loaderOur ‘controls.s’ demo-programDepiction of ‘boot-strapping’In-class exercise #1In-class exercise #2In-class exercise #3What is ‘bootstrapping’?The process of loading larger programs for execution than can fit within a single disk-sectorSerious Pentium explorations•Experimenting with most Pentium features will require us to write larger-size demos than can fit in one disk-sector (512 bytes) •So we need a way to load such programs into memory when no OS is yet running•And we need a convenient way to place such programs onto a persistent storage medium so they can easily be accessedOur classroom setup•Our workstations’ hard disks have been ‘partitioned’ in way that provides a large unused storage-area for us to use freely •But other portions of these hard disks are dedicated to supporting vital courseware for students who are taking other classes•We have to understand how to access our ‘free’ area without disrupting anyone elseFixed-Size ‘blocks’•All data-transfers to and from the hard disk are comprised of fixed-size blocks called ‘sectors’ (whose size equals 512 bytes)•On modern hard disks, these sectors are identified by sector-numbers starting at 0•This scheme for addressing disk sectors is known as Logical Block Addressing (LBA)•So the hard disk is just an array of sectorsVisualizing the hard disk0 1 2 3 …..A large array of 512-byte disk sectorsDisk storage-capacity (in bytes) = (total number of sectors) x (512 bytes/sector)Example: If disk-capacity is 160 GigaBytes, then the total number of disk-sectors can be found by division:(160000000000 bytes) / (512 bytes-per-sector) assuming that you have a pocket-calculator capable of displaying enough digits!Disk Partitions•The total storage-area of the hard disk is usually subdivided into non-overlapping regions called ‘disk partitions’ Partition #1 Partition #2 Partition #3unusedMaster Boot Record•A small area at the beginning of the disk is dedicated to ‘managing’ the disk partitions•In particular, sector number 0 is known as the Master Boot Record (very important!)MBR0 1 2 …partition #1Format of the MBR•The MBR is subdivided into three areas:–The boot loader program (e.g., GRUB)–The ‘partition table’ data-structure–The MBR signature (i.e., 0x55, 0xAA)signature (2 bytes)Partition Table (64 bytes)Boot Loader(446 bytes) 512bytes‘Reading’ the MBR•To see the hard disk’s Partition Table, we must ‘read’ the entire Master Boot Record•(We ignore the boot-loader and signature)•But we will need to understand the format of the data stored in that Partition Table•We first need to know how to devise code that can transfer the MBR (sector 0) from the hard-disk into a suitable memory-areaPartition Table Entries•The MBR is an array containing four data-structures (called ‘partition-table entries’):Starting sectorID-numberPartition length(in sectors)STATUSTYPE 16bytesSome fields contain ‘obsolete’ informationTYPE-ID•Each partition-table entry has a TYPE-ID–TYPE-ID is 0x07 for a ‘Windows’ partition–TYPE-ID is 0x83 for our ‘Linux’ partition–TYPE-ID is 0x00 when the entry is ‘unused’•You can find a list of TYPE-ID numbers posted on the internet (see our website)•Our disks have an extra ‘Linux’ partition that nobody else is using this semesterBIOS Disk Drive Services•An assortment of disk-access functions is available under software Interrupt 0x13 •Originally there were just six functions (to support IBM-PC floppy diskette systems)•More functions were added when PC/XTs introduced the use of small Hard Disks•Now, with huge hard disk capacities, there is a set of “Enhanced Disk Drive” servicesPhoenix Technologies Ltd•You can find online documentation for the BIOS EDD specification 3.0 (see website)•We’ll use function 0x42 to read the MBR•It requires initializing some fields in a small data-structure (the “Disk-Address Packet”)•Then we load parameters in four registers (DS:SI = address of the DAP, DL = disk-ID and AH = 0x42) and execute ‘int $0x13’EDD Disk-Address Packetreserved(=0x00)sectorcountreserved(=0x00)packetlengthsegment-addressof transfer-areaoffset-addressof transfer areaLogical Block Address of disk-sector (64-bits)Physical-address of memory transfer-area (64-bits)(in case segment:offset above is 0xFFFF:FFFF) 7 6 5 4 3 2 1 0The MBR parameters#-------------------------------------------------------------------------------------------packet: .byte 16, 0 # packet-size = 16 bytes.byte 1, 0 # sector-count = 1 sector.word 0x0200, 0x07C0 # transfer-area’s address.quad 0 # MBR’s Logical Block Address#-------------------------------------------------------------------------------------------Here are assembly language statements that you could use to create a Disk Address Packet for reading the hard-disk’s Master Boot Record into the memory-area immediately following the 512-byte BOOT_LOCN area Our demo-program (named ‘finalpte.s’) uses statements similar to these.How we search the Partition Table•Our demo-program ‘finalpte.s’ locates the final valid entry in the MBR Partition Table•It displays the contents of that entry (i.e., four longwords) in hexadecimal format•To do its search, it simply scans the table entries in backward order looking for the first entry that has a nonzero ‘type’ codeInstructions we could usemov $0x03FE, %si # point DS:SI to signature-wordmov $4, %cx # setup count of table’s entriesnxpte:sub $16, %si # back up to the previous entrycmpb $0x00, 4(%si) # entry’s type-code is defined?loope nxpte # no, examine the next entryjcxz nopte # search fails if CX reached 0# If we get here, then DS:SI is pointing to the final valid PT-entryjmp foundnopte: # We should never arrive here -- unless no valid partitions exist‘Extended’ partitions•The hard-disk’s Master Boot Record only has room for four Partition-Table Entries•But some systems need to use more than four disk-partitions, so a way was


View Full Document

USF CS 686 - LECTURE NOTES

Documents in this Course
Load more
Download LECTURE NOTES
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view LECTURE NOTES and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view LECTURE NOTES 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?