Page 1 of 1

E820 memory map for 64 bit

Posted: Tue Jul 03, 2007 5:55 pm
by Baold
Hi,

I plan to make my OS in 64bit long mode.

I use the E820 int 15h interrupt to get the memory map.

qemu-system-x86_64 give me this memory map :

Code: Select all

0000000000000000 000000000009FC00 FREE
000000000009FC00 0000000000000400 -- reserved --
00000000000E8000 0000000000018000 -- reserved --
0000000000100000 0000000007F00000 FREE
00000000FFFC0000 0000000000040000 -- reserved --
The memory at the top of the 32 bit adress space (00000000FFFC0000) seems to be the bios memory space.

When switching to 64bit long mode, will the bios memory change to the top of 64 bit adress space (FFFFFFFFFFFC0000) or stay at the same adress (00000000FFFC0000) ?

Re: E820 memory map for 64 bit

Posted: Tue Jul 03, 2007 9:30 pm
by Brendan
Hi,
Baold wrote:When switching to 64bit long mode, will the bios memory change to the top of 64 bit adress space (FFFFFFFFFFFC0000) or stay at the same adress (00000000FFFC0000) ?
The physical memory layout (including where the BIOS is) is controlled by the chipset. The chipset doesn't know (or care) what mode the CPU is running in, and nothing in physical memory changes when you switch to long mode (or from any CPU mode to any other CPU mode).

However, to enable long mode you need to setup paging. This means you create your own virtual address space that might (or might not) look like the physical address space. You choose how virtual addresses are mapped to physical addresses.


Cheers,

Brendan

Posted: Wed Jul 04, 2007 1:13 pm
by Baold
Thanx for this good explanation :D

For my memory manager, I'll set as free pages, the pages in the free area, and set as used pages, the pages in reserved area.