Memory Models: and what is "unreal mode?"
Posted: Sat Jun 05, 2004 7:37 pm
Hi, I'm finding that I am being hindered by addressing, memory management and memory models. I really need to properly understand all this stuff before I can do anything terrific.
What are the memory models? There's 16-bit real mode, where there are only 64K segments, or somesuch; there's "unreal" mode (is that where you enable the A20 gate so you have 32-bit addressing, but are working with physical memory, but still have access to the BIOS and you aren't yet in pmode, hence "unreal" mode?), and then of course there's 32-bit protected mode, and then there's the AMD x86-64's 64-bit mode. Not sure about that. I haven't yet saved up the cash to get a 64-bit PC, but that is definately what I am going to do next.
I am trying not to be confused by DOS memory models and the real memory models offered by Intel and compatible chips. As far as I know, when there are 64KB segments in 16-bit real mode, in theory an application could use an address space much larger, but will need "near" and "far" pointers, and changes of segment registers.
Is that all there is? 16-bit segmented real mode, unreal mode (16/32 bit? Physical addresses? BIOS access OK? Segments? Flat?), 32-bit flat protected mode with no segments in the sense of 16-bit segmented mode, (also add something about Virtual 8086 Mode - what is it, how to switch in and out of it as well...), and then 64-bit mode offered by the AMD x86-64. I'll cover that last one in great detail after I get my 64-bit PC and have learned about it.
I would also like more details on the BIOS, especially detecting the amount of memory installed and so on. I believe there is a limitation in the BIOS or something which means perhaps there is somewhere else in the ROM where the amount of memory can be detected, and such.
In any mode, theoretically the kernel could be loaded at 2K, right? Since there is only so much space the interrupt vectors for real mode take up. If the kernel is loaded at 2K, then it must take care not to bump into the 640K BIOS starting point... what is the physical address the BIOS starts at, exactly the offset for 640KB? It runs until 1MB, with the 1024th (or 1025th?) kilobyte being available for general use? I wonder where I can find the BIOS memory map, so that a structure describing BIOS reserved memory areas can be built? There are various addresses that are reserved high in memory (or mapped there anyway) like the PCI configuration space aka 32-bit PCI BIOS, and so on...
Hmm... does anyone know of any documentation available for a modern "standard" BIOS? Also, any decent literature on memory models?
Ah yes, I need to understand more about stacks and heaps... I'll come back to that later.
What are the memory models? There's 16-bit real mode, where there are only 64K segments, or somesuch; there's "unreal" mode (is that where you enable the A20 gate so you have 32-bit addressing, but are working with physical memory, but still have access to the BIOS and you aren't yet in pmode, hence "unreal" mode?), and then of course there's 32-bit protected mode, and then there's the AMD x86-64's 64-bit mode. Not sure about that. I haven't yet saved up the cash to get a 64-bit PC, but that is definately what I am going to do next.
I am trying not to be confused by DOS memory models and the real memory models offered by Intel and compatible chips. As far as I know, when there are 64KB segments in 16-bit real mode, in theory an application could use an address space much larger, but will need "near" and "far" pointers, and changes of segment registers.
Is that all there is? 16-bit segmented real mode, unreal mode (16/32 bit? Physical addresses? BIOS access OK? Segments? Flat?), 32-bit flat protected mode with no segments in the sense of 16-bit segmented mode, (also add something about Virtual 8086 Mode - what is it, how to switch in and out of it as well...), and then 64-bit mode offered by the AMD x86-64. I'll cover that last one in great detail after I get my 64-bit PC and have learned about it.
I would also like more details on the BIOS, especially detecting the amount of memory installed and so on. I believe there is a limitation in the BIOS or something which means perhaps there is somewhere else in the ROM where the amount of memory can be detected, and such.
In any mode, theoretically the kernel could be loaded at 2K, right? Since there is only so much space the interrupt vectors for real mode take up. If the kernel is loaded at 2K, then it must take care not to bump into the 640K BIOS starting point... what is the physical address the BIOS starts at, exactly the offset for 640KB? It runs until 1MB, with the 1024th (or 1025th?) kilobyte being available for general use? I wonder where I can find the BIOS memory map, so that a structure describing BIOS reserved memory areas can be built? There are various addresses that are reserved high in memory (or mapped there anyway) like the PCI configuration space aka 32-bit PCI BIOS, and so on...
Hmm... does anyone know of any documentation available for a modern "standard" BIOS? Also, any decent literature on memory models?
Ah yes, I need to understand more about stacks and heaps... I'll come back to that later.