56 | | 1. The '''utils''' zone is located in the lower part of the virtual space. It contains the three vsegs ''kentry'', ''args'', ''envs'', whose sizes are defined by configuration parameters. The ''kentry'' vseg (CODE type) contains the code that must be executed to enter the kernel from user space. The ''args'' vseg (DATA type) contains the process main() thread arguments. The ''envs'' vseg (DATA type) contains the process environment variables. |
57 | | 1. The '''elf''' zone is located on top of the '''utils''' zone. It is defined by the CONFIG_USER_ELF_BASE and CONFIG_USER_ELF_SIZE parameters. It contains the ''text'' vseg (CODE type) and ''data'' vseg (DATA type) defining the process binary code and global data. The actual vsegs sizes are defined in the .elf file and reported in the boot_info structure by the boot loader. |
58 | | 1. The '''heap''' zone is located on top of the '''elf''' zone. It is defined by the CONFIG_USER_HEAP_BASE and CONFIG_USER_HEAP_SIZE parameters. It contains one single ''heap'' vseg, used by the malloc() library. |
59 | | 1. The '''mmap''' zone is located on top of the '''heap''' zone. It is defined by the CONFIG_USER_MMAP_BASE and CONFIG_USER_MMAP_SIZE parameters. It contains all vsegs of type ANON, FILE, or REMOTE that are dynamically allocated / released by the user application. The VMM implements a specific MMAP allocator for this zone. |
60 | | 1. The '''stack''' zone is on top of the '''mmap''' zone. It is defined by the CONFIG_USER_STACK_BASE * CONFIG_USER_STACK_SIZE parameters. It contains an array of fixed size slots, and each slot contain one ''stack'' vseg. In each slot the first page is not mapped to detect stack overflow. |
61 | | As threads can be dynamically created and destroyed, the VMM implement a specific STACK allocator for this zone. |
| 56 | === The ''utils'' zone === |
| 57 | It is located in the lower part of the virtual space, and starts a address 0. It contains the three vsegs ''kentry'', ''args'', ''envs'', whose sizes are defined by specific configuration parameters. The ''kentry'' vseg (CODE type) contains the code that must be executed to enter the kernel from user space. The ''args'' vseg (DATA type) contains the process main() arguments. The ''envs'' vseg (DATA type) contains the process environment variables. |
| 58 | |
| 59 | === The ''elf'' zone === |
| 60 | It is located on top of the ''utils'' zone, and starts at address defined by the CONFIG_VSPACE_ELF_BASE parameter. It contains the ''text'' vseg (CODE type) and ''data'' vseg (DATA type) defining the process binary code and global data. The actual vsegs base addresses and sizes are defined in the .elf file and reported in the boot_info structure by the boot loader. |
| 61 | |
| 62 | === The ''heap'' zone === |
| 63 | It is located on top of the ''elf'' zone, and starts at address defined by the CONFIG_VSPACE_HEAP_BASE parameter. It contains one single ''heap'' vseg, used by the malloc() library. |
| 64 | |
| 65 | === The ''mmap'' zone === |
| 66 | It is located on top of the ''heap'' zone, and starts at address defined by the CONFIG_VSPACE_MMAP_BASE parameter. It contains all vsegs of type ANON, FILE, or REMOTE that are dynamically allocated / released by the user application. The VMM implements a specific MMAP allocator for this zone, implementing the ''buddy'' algorithm. |
| 67 | |
| 68 | === The ''stack'' zone === |
| 69 | It is located on top of the ''mmap'' zone and starts at address defined by the CONFIG_VSPACE_STACK_BASE parameter. It contains an array of fixed size slots, and each slot contain one ''stack'' vseg. The size of a slot is defined by the CONFIG_VSPACE_STACK_SIZE. In each slot the first page is not mapped to detect stack overflow. |
| 70 | As threads can be dynamically created and destroyed, the VMM implement a specific STACK allocator for this zone, using a bitmap vector. |