Page 1 of 1

doubt on a specific section in xv6 kernel pdf

Posted: Mon Jun 02, 2014 5:31 pm
by arunsk
Hello,

I am reading the xv6 teaching kernel book from MIT website alongside the code. In the book there is a section on page 88 which says "A virtual segment:offset can yield a 21-bit physical address, but the Intel 8088 could only address 20 bits of memory..".
Now my question is, If the segment register is 16 bits (2 ^ 4) and offset width is 16 bits then together they can refer up to
2 ^ 4 * 2 ^ 16 which is 2 ^ 20 memory region so in effect they would yield only 20-bit physical address right ? where am i going wrong in this ? :roll:

Thanks,
Arun

Re: doubt on a specific section in xv6 kernel pdf

Posted: Mon Jun 02, 2014 9:39 pm
by alexfru
i80286 and later CPUs have more than 20 address bits.

If you do the math, the maximum possible address using this seg:ofs scheme is greater than 1MB (IOW, needs more than 20 bits):

0xFFFF:0xFFFF -> 0xFFFF * 0x10 + 0xFFFF = 0x10FFEF.

For compatibility with the i8086/i80186 the address bit 20 (AKA A20) can be optionally enabled or disabled (that is, tied to 0).

I think you should be able to find answers to such questions in various documentation from intel/AMD/Microsoft (e.g. MSDOS had options to use those nearly 64KB after the 1MB point to load drivers and parts of itself there).