After spending loadz & loadz of time debugging timing signals in GTKwave finally found sometime to update the blog . It’s 3:30 am in the morn… Thought this article would be worth to write . This article is one of the basics things a undergrad student who has taken OS must know but .. even the most guys even after taking Advanced Operating System course fail to know ….
Most of you while installing the OS must have had a problem saying that the bootable partition must be within 1024 cylinders. What is it exactly ??? For those who dnt know what a cylinder is .. google for it.. First i would like to throw light on boot sequence . When the computer is switched on
1) The BIOS has a program in it which is the first program run by the computer . This program reads the MBR . The MBR has 2 things boot code and MBR entires(info abt partions) . The code in the MBR reads THE FIRST SECTOR in the hard disk which contains the again contains code for a secondary boot loader . This boot loader checks which partion is bootable from the MBR records and loads the OS from that partition . Now where does the problem arise ????
The each MBR record contains 10 bits for cylinder and 8 bits for head(starts from 1) and 6 bits for sector(starts from 1)
so 1024 cylinders 255 head and 63 sectors can be represented ( If you dnt know abt CHS representation google it!!! or betta repeat the OS course )
so 1024*255*63*512( assuming each sector is 512 bytes) = 8GB (approx)
So.. the bootable partition has to be within first 8GB of hard disk 😦 . But we have hard disks of immense capacity eg:320 GB can’t i have bootable partition beyond it!!!!!! Read on!!!!
You must know something about interrupt . When an OS wants to read a chunk of data what it does??? It issues a INT 18(software interrupt & bios interrupt) . Before calling the interrupt it sets the values of specified registers to the CHS (Cylinder,Head,Sector) . After this interrupt data transfer takes place . Again the problem here is there is only provision for 10 bit addr for cylinder , 8 and 6 bits for head and cylinder .
Here comes LBA (Logical block addressing ) . Which assigns a unique number of each and every sector in the disk . CHS ->LBA translation is nothing but for each and every sector of the disk a unique number is assigned . Is LBA responsible for enabling to access boot partions beyond 8 GB no!!!!! Then what is it ???
The CHS used at 13h(BIOS side is ) L-CHS and the one that is used at disk drive is P-CHS . Suppose you want the boot partition to be present upto 4095 cylinder then 12 bits is allocated for cylinder and remaining 6 bits for head . Therefore the L-CHS has specification 1024 cylinders and 256 heads and 63 sectors while the P-CHS has the specifications 4096 cylinders 63 heads and 63 sectors . So when the CHS value at the MBR is sent to the 13h . The which is L-CHS . WHen the disk read command is issued the LCHS is converted to P-CHS thus >1024 cylinders is supported.
The caculations for L-CHS to P-CHS will be uploaded in the next update . These types of BIOS r no longer used . A newer types of bios is used which also supports 42h interrupt the details of which is also be in next blog . Why i need to know all this stuff??? If you want to write an Os , device driver , boot loaderyou can’t wothout these basic fundas!!!!!!!1