x86-64: Mapping memory without holes
Posted: Tue Jan 05, 2016 3:42 pm
A little background... I have a mono-tasking, SMP-enabled, OS written in x86-64 Assembly. I would like to have a contiguous area of memory available at address 0xFFFF800000000000 for the running application. Memory is currently mapped with 2MiB pages.
The kernel would be in the first 2MB of RAM starting at 0x0. The GDT, IDT, PML4, etc would also be there.
All other free memory would be mapped starting at address 0xFFFF800000000000. This is where I want the application to run in.
Ideally what I am expecting on a system with 256MB of RAM is a memory map of 2MB at 0x0 and 254MB (or close to it) at 0xFFFF800000000000.
A few questions:
1) Is this possible?
2) Do I still need to map physical memory to things like the APIC/IOAPIC at 0xFEE00000/0xFEC00000?
Thanks,
-Ian
Code: Select all
Example memory map for a 256MB QEMU instance:
Base Address | Length | Type
0x0000000000000000 | 0x000000000009FC00 | Free Memory (1)
0x000000000009FC00 | 0x0000000000000400 | Reserved Memory (2)
0x00000000000F0000 | 0x0000000000010000 | Reserved Memory (2)
0x0000000000100000 | 0x000000000FEDF000 | Free Memory (1)
0x000000000FFDF000 | 0x0000000000021000 | Reserved Memory (2)
0x00000000FFFC0000 | 0x0000000000040000 | Reserved Memory (2)
All other free memory would be mapped starting at address 0xFFFF800000000000. This is where I want the application to run in.
Ideally what I am expecting on a system with 256MB of RAM is a memory map of 2MB at 0x0 and 254MB (or close to it) at 0xFFFF800000000000.
A few questions:
1) Is this possible?
2) Do I still need to map physical memory to things like the APIC/IOAPIC at 0xFEE00000/0xFEC00000?
Thanks,
-Ian