A question about EM64T Memory Management
Posted: Sun Mar 01, 2009 1:37 pm
< My Design - this model is not final by any means, I will change this model when I write the multitasking features. >
(Physical Memory Manager) (Kernel Virtual Memory Manager)
I. Boot Steps
1. Boot Loader (loads the Kernel Image. The Kernel Image consists of two parts, Kernel Loader/Kernel.)
2. Kernel Loader (enables Long Mode and relocates the Kernel, maps the Kernel at high area-0xFFFF800000000000, for an initial structure, the low 1-MB memory is mapped at 0x0~0xFFFFF, and the kernel is mapped at 0xFFFF800000000000-0xFFFF8000003FFFFF).
3. Kernel
II. Kernel Initialisation Procedure
1. Initialisation of the Kernel Virtual Memory Manager (creates a new paging structure that is managed by the kernel, maps 32MB at 0xFFFF800000000000 for the kernel, maps the low 1-MB area at high area- 0xFFFFFFFFFFF00000).
2. Initialisation of the Physical Memory Manager (PMM manages the physical memory area to determine whether a specific physical memory block is used).
Issues
1. Getting the physical memory size after the Long Mode is enabled: paging is mandatory in long mode. For this reason, it is necessary to map a physical page for brute-force scanning. For example, map Page 0 (VA 0x0~0xFFF) to 0x100000 and test, map 0x200000 and test, and so on). Is there a better way of doing this?
2. It is necessary to construct a physical memory allocation table for the Physical Memory Manager, where each allocation entry must keep track of the page allocation count for shared memory feature. I decided to make each entry 4 bytes long and, if the physical memory is 512GB, this would render the Physical Memory Allocation Table size to be 512 MB (1024*1024*1024*512/4096*4/1024/1024), which is bigger than initial map space 32MB. Is there a solution for this?
(Physical Memory Manager) (Kernel Virtual Memory Manager)
I. Boot Steps
1. Boot Loader (loads the Kernel Image. The Kernel Image consists of two parts, Kernel Loader/Kernel.)
2. Kernel Loader (enables Long Mode and relocates the Kernel, maps the Kernel at high area-0xFFFF800000000000, for an initial structure, the low 1-MB memory is mapped at 0x0~0xFFFFF, and the kernel is mapped at 0xFFFF800000000000-0xFFFF8000003FFFFF).
3. Kernel
II. Kernel Initialisation Procedure
1. Initialisation of the Kernel Virtual Memory Manager (creates a new paging structure that is managed by the kernel, maps 32MB at 0xFFFF800000000000 for the kernel, maps the low 1-MB area at high area- 0xFFFFFFFFFFF00000).
2. Initialisation of the Physical Memory Manager (PMM manages the physical memory area to determine whether a specific physical memory block is used).
Issues
1. Getting the physical memory size after the Long Mode is enabled: paging is mandatory in long mode. For this reason, it is necessary to map a physical page for brute-force scanning. For example, map Page 0 (VA 0x0~0xFFF) to 0x100000 and test, map 0x200000 and test, and so on). Is there a better way of doing this?
2. It is necessary to construct a physical memory allocation table for the Physical Memory Manager, where each allocation entry must keep track of the page allocation count for shared memory feature. I decided to make each entry 4 bytes long and, if the physical memory is 512GB, this would render the Physical Memory Allocation Table size to be 512 MB (1024*1024*1024*512/4096*4/1024/1024), which is bigger than initial map space 32MB. Is there a solution for this?