doubt on a specific section in xv6 kernel pdf

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
arunsk
Posts: 5
Joined: Fri May 27, 2011 5:50 pm

doubt on a specific section in xv6 kernel pdf

Post 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
alexfru
Member
Member
Posts: 1112
Joined: Tue Mar 04, 2014 5:27 am

Re: doubt on a specific section in xv6 kernel pdf

Post 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).
Post Reply