Skip to content

Latest commit

 

History

History
119 lines (111 loc) · 4.43 KB

address.md

File metadata and controls

119 lines (111 loc) · 4.43 KB

physical address space

 +------------------+  <- 0xFFFFFFFF (4GB)
 |    无效空间      |
 |                  |
 +------------------+  <- addr: 3G+256M
 |      256MB       |
 |  IO外设地址空间  |
 |                  |
 +------------------+  <- 0xC0000000 (3GB)
 |                  |
 /\/\/\/\/\/\/\/\/\/\
 
 /\/\/\/\/\/\/\/\/\/\
 |    无效空间      |
 +------------------+  <- 0x40000000 (1GB)
 |                  |
 |  实际有效内存    |
 |                  |
 +------------------+  <- 0x00100000(1MB)
 |   BIOS ROM       |
 +------------------+  <- 0x000F0000 (960KB)
 |  16-bit devices, |
 |  expansion ROMS  |
 +------------------+  <- 0x000C0000 (768KB)
 |  VGA Display     |
 +------------------+  <- 0x000A0000 (640KB)
 |                  |
 |    Low Memory    |
 |                  |
 +------------------+  <- 0x00000000


physical address space after memory pages map finished

 +------------------+  <- 0xFFFFFFFF (4GB)
 |32bit设备映射空间 |
 +------------------+
 |                  |
 +------------------+  <- 实际物理内存空间结束地址
 |     空闲内存     |
 +------------------+  <- 空闲内存空间的起始地址 freemem
 |n*sizeof(struct   |  <- 管理空闲空间的区域
 |           Page)  |
 +------------------+  <- BSS段结束地址
 |  ucore的BSS段    |
 +------------------+  <- 基于ucore数据大小
 |  ucore的DATA段   |
 +------------------+  <- 基于ucore代码大小
 |  ucore的TEXT段   |
 +------------------+  <- 0x00100000(1MB)
 |   BIOS ROM       |
 +------------------+  <- 0x000F0000 (960KB)
 |  16-bit devices, |
 |  expansion ROMS  |
 +------------------+  <- 0x000C0000 (768KB)
 |  CGA 显存空间    |
 +------------------+  <- 0x000B8000
 |     空闲内存     |
 +------------------+  <- 0x00011000 (+4KB)
 |ucore的ELF header |
 |数据              |
 +------------------+  <- 0x00010000
 |     空闲内存     |
 +------------------+  <- 基于bootloader大小
 |bootloader的TEXT段|
 |+ DATA段          |
 +------------------+  <- 0x00007C00 (栈顶)
 |bootloader和ucore |
 |共用的堆栈        |
 +------------------+  <- 基于堆栈的使用情况
 |    Low Memory    |
 +------------------+  <- 0x00000000


virtual address space

Virtual memory map:                                          Permissions
                                                             kernel/user

    4G ------------------> +---------------------------------+
                           |                                 |
                           |         Empty Memory (*)        |
                           |                                 |
                           +---------------------------------+ 0xFB000000
                           |   Cur. Page Table (Kern, RW)    | RW/-- PTSIZE
    VPT -----------------> +---------------------------------+ 0xFAC00000
                           |        Invalid Memory (*)       | --/--
    KERNTOP -------------> +---------------------------------+ 0xF8000000
                           |                                 |
                           |    Remapped Physical Memory     | RW/-- KMEMSIZE
                           |                                 |
    KERNBASE ------------> +---------------------------------+ 0xC0000000
                           |        Invalid Memory (*)       | --/--
    USERTOP -------------> +---------------------------------+ 0xB0000000
                           |           User stack            |
                           +---------------------------------+
                           |                                 |
                           :                                 :
                           |         ~~~~~~~~~~~~~~~~        |
                           :                                 :
                           |                                 |
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                           |       User Program & Heap       |
    UTEXT ---------------> +---------------------------------+ 0x00800000
                           |        Invalid Memory (*)       | --/--
                           |  - - - - - - - - - - - - - - -  |
                           |    User STAB Data (optional)    |
    USERBASE, USTAB------> +---------------------------------+ 0x00200000
                           |        Invalid Memory (*)       | --/--
    0 -------------------> +---------------------------------+ 0x00000000