// /include/mmu.h 文件内容。这个图很重要,需要经常看,最好记下来。 /* o 4G -----------> +----------------------------+------------0x100000000 o | ... | kseg2 o KSEG2 -----> +----------------------------+------------0xc000 0000 o | Devices | kseg1 o KSEG1 -----> +----------------------------+------------0xa000 0000 o | Invalid Memory | /|\ o +----------------------------+----|-------Physical Memory Max o | ... | kseg0 o KSTACKTOP-----> +----------------------------+----|-------0x8040 0000-------end o | Kernel Stack | | KSTKSIZE /|\ o +----------------------------+----|------ | o | Kernel Text | | PDMAP o KERNBASE -----> +----------------------------+----|-------0x8001 0000 | o | Exception Entry | \|/ \|/ o ULIM -----> +----------------------------+------------0x8000 0000------- o | User VPT | PDMAP /|\ o UVPT -----> +----------------------------+------------0x7fc0 0000 | o | pages | PDMAP | o UPAGES -----> +----------------------------+------------0x7f80 0000 | o | envs | PDMAP | o UTOP,UENVS -----> +----------------------------+------------0x7f40 0000 | o UXSTACKTOP -/ | user exception stack | BY2PG | o +----------------------------+------------0x7f3f f000 | o | | BY2PG | o USTACKTOP ----> +----------------------------+------------0x7f3f e000 | o | normal user stack | BY2PG | o +----------------------------+------------0x7f3f d000 | a | | | a ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | a . . | a . . kuseg a . . | a |~~~~~~~~~~~~~~~~~~~~~~~~~~~~| | a | | | o UTEXT -----> +----------------------------+------------0x0040 0000 | o | reserved for COW | BY2PG | o UCOW -----> +----------------------------+------------0x003f f000 | o | reversed for temporary | BY2PG | o UTEMP -----> +----------------------------+------------0x003f e000 | o | invalid memory | \|/ a 0 ------------> +----------------------------+ ---------------------------- o */