Why should bootable partition be within 1024 cylinders and how to overcome it??

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

Advertisements

Processor Architecture

Finally decided to do something which i can put in my resume . So I, Rajesh and Ram decided to take up design of the processor . I chose to design the architecture of the processor . I was confused between whether to design the processor to support direct addressing or just immediate addressing . So i first came up with an architecture which would support only immediate addressing otherwise the control unit design would become really tedious . The timing signal generation would be a mammoth task . Then i later decided k let’s include direct addressing also . Now the architecture is ready . The control unit is yet to be designed . The architecture has 2 small mistakes . First is it should be RAM instead of ROM and output port and the data in port must be diff but in the diagram its the same so have to change that :(. Other one you guys have to find and comment . I’m uploading the image of the architecture so you guys can also get some ideas of how to design and to even comment my own design so i can correct it .

I have not included bus to reduce complexity . Instead i have used a register file which is much more easier to generate signals for.

h

Oppurtunity or Tragedy……

So today my TA duty gets over. For the past couple of days it has been a overload of Altera FPGA kits . Even a day more of fpga kits i would have started hating these kits which i used to love . I , Rajesh , Ramachandran were the hardware lab TA’s . Few days back we got a shock from the prof . One of my team members Rajesh was working in the lab . Prof Shankar asked how the TA job was going .Rajesh told it’s almost over . The prof told that the TA duty for digital ckts lab which we were to take care next semester had been cancelled coz the senate did not approve the course . He asked rajesh whether we guys would like to continue as hardware lab TA’s . The prof told next sem we dnt have to do any work ( When my friend said this i got a immediate smile on my face but it’s was so short lived..) . The prof continued . He said that he was to form a system programming team . He told that he has plans of making device available online .. What??? Online how ????? K The embedded device would be shared in the LAN . So ppl do not need a physical access to the device . Instead the programs which we want to burn would be transferred over the LAN and flushed into the ckts and the o/p’s will be sent back to the LAN .He asked whether we are taking device drivers course next sem . We said yes .Then he asked whether we guys would like to write the device driver for it . We were not able to say yes or no coz we know that we are sure to get banged by the course work next semester . We have planned to take the most heavy courses . We have been searching for a oppurtunity like this . To work under him is like the coolest thing . Not many get that oppurtunity but thinking how we could get time is making us tensed . Still we guys are confused whether to accept the offer or not . SO we decided to meet him and talk to him again . Hope things turns out to be in favour of us……….

Things to ponder…..

Yesterday when i was writing the printf statement in C suddenly something went thro’ my mind.. It’s nothing but the variable arguments i entered in printf . This function is accepts variable arguments then y doesn’t user written function doesn’t accept it ??? A good itch …. I found out that even user written functions to can accept the variables too .. The answer is MACROS

va_list , va_start,va_arg , va_end these macros r responsible for the magic . They are available in stdarg.h

va_list – is used to declare a list that will hold the variable arguments

Eg : va_list list;

va_start – Used to u=initialize the list . va_start ( list created using va_list , name of the first static argument )

va_arg ( list created using va_list , data type ) each time the function is called we get one of the arguments

va_arg (list created using va_list)

#include “stdio.h”
#include “stdarg.h”

void print(char *msg,…) //notice the use of … which indicates that the function will receive variable arguments
{
int i;
va_list list;
va_start(list,msg);
printf(va_arg(list,int));
printf(va_arg(list,int));
printf(va_arg(list,int));
printf(va_arg(list,int));
printf(va_arg(list,int));
printf(va_arg(list,int));
va_end(list)
}
int main()
{
print(“abhinav”,1,2,3,4,5,6);
return 0;
}

I compliled the program using a gnu c compiler .

2012…

Today i watched this movie @ sathyam cinemas……. Ho!!!!!!!! man what a movie… What effects … Simply loved each and every frame… This movie highlighted india and indians…that was kind of nice… I liked it… The main reason for this post is to a recap of what happened before we went to the movie……..

K i was in lab with this stupid TA duty… It was earlier planned that around 8 guys would go for the movie .

Me : Hey Rajesh come on man it’s already 7 lets start for the movie….
Rajesh: Hey sorry man i have a project in man .. i gotto start it otherwise i won’t get sleep..
Me: Hey too much man … we can do tomo let’s party today..
Rajesh : No da u proceed..

I was completely vexed then the next conversation

Me: Hey rama where r u ???? shall we start to movie????
Ram:Macha i’m in my friends house da..Today rajesh told that we will going to movie on someother day so i started

Again disappointed… Then i called Aniket

Me : Hey ani where r u??????
Aniket : I’m in Ascendas with my old friends….

I was like.. What the fuck…………. 3 guys down… I called the remaining

Anuj ,Shanky , Panky.. They were like hey dude come on lets move … I was truely excited . Most of my friends r starting to their native today . They had hired a cab so we joined them and got down at sathyam…. Finally got to watch the movie…. Enjoyed it thorougly … Between we had our dinner at Noodle house forgot to mention abt it . And the special highlight of the night is anuj was about to enter girls rest room and the security guys was like hey where r u going ??? that’s girls bathroom !! What a bulb $#$#%^$^%&

First sem @ IIT ends…

The first sem in IIT ends today… Couldn’t beleive it … Time is flying so fast . It seems like i just finished my BE . Life in this 3 months was really a new experience . Enjoyed each and everyone second here . I got the feel of belonging to the institute which i failed to get in my BE . I feel its my institute and i have to do something in return for everything i get here . One can see a lot of alumini paying back . Whenever i see that ,i feel that i should also do something for the institute someday . We students here get the feeling of being respected .

Hostel life is truely amazing . Nightout , chatting with friends , eat at 2 am , coffee day , late night movies , night outs before assignment submission whoa!!! what a semester … Finally we burnt the midnight oil before the exams . Finally, managed to finish the exams and hoping a decent score even though not a very score 😦 . I have got more than a month holidays now . Thinking what to do … I have a couple of plans in my mind . Dnt know how much i am going to implement . Let’s c….

Welcome!!!!!!!!!

Hey Frenz …. Welcome to my blog . Peep into this place to know more about me and my life . I decided to keep this blog kind of active . I will be posting everything from techie stuffs , problems i faced and how i solved them and even few personal incidents . Don’t forget to leave your comment . So let’s start Blogging !!!!!!!!!!