Page 1 of 1
Explanation required for Linux source code [setup.s]
Posted: Thu Mar 10, 2011 7:56 am
by osdevkid
Dear All,
I have attached a linux boot sector file [bootsect.s]
I have read the code several times, but few lines I cant able to understand, can you please help me ?
Line numbers from 172 to 174.
Re: Explanation required for Linux source code [setup.s]
Posted: Thu Mar 10, 2011 8:44 am
by Tosi
Shifting an unsigned value left by 9 effectively multiplies it by 2^9, which is 512, the size of a sector. So it is converting a number of sectors into the size of those sectors in bytes, and adding bx, which is explained above as "bx is starting address within segment".
Re: Explanation required for Linux source code [setup.s]
Posted: Thu Mar 10, 2011 8:49 am
by Combuster
Its a left shift by 9 bits, in other words, a multiplication by 512. In this case it looks like they are converting sectors to bytes.
Re: Explanation required for Linux source code [setup.s]
Posted: Thu Mar 10, 2011 9:14 am
by osdevkid
Oh god, how simple it is, I cant able to get it.
Thank you very much for Tosi and Cumbuster.