Hi,
carbonBased wrote:In which way is this supposed to make VM86 easier?
Because virtual 8086 tasks must use the lowest 1 MB of linear memory, so if you plan on having several "DOS boxes" or something you'll be screwed if the lowest 1 MB is mapped the same into every address space (e.g. treated the same as kernel space). There are ways around this, but in general leaving the lowest N MB for user applications would make it easier to allow any user-level processes to contain virtual 8086 code.
Some people only use virtual 8086 for "thunking" (a way to run crusty BIOS functions). In this case it could be easier to build the virtual 8086 code into the kernel (and therefore put the kernel at the beginning of address spaces). IMHO the only sane excuse for this sort of hack is video code (VBE functions).
2. More generically, user applications are not dependent of how many memory is kernel space (your app can be linked for 0x400000 regardless of whether kernel is at 0xC0000000, 0x80000000 or 0xE0000000 ...), which makes ABIs nicer.
carbonBased wrote:That's not really true, in my opinion. Applications or no more or no less dependant on kernel memory space whether its at the top, or at the bottom.
Simply put, if the kernel's at the top, apps can't be in the top. If it's at the bottom, apps can't be in the bottom. These restrictions extend to both systems.
So if the kernel is from 0x00000000 to 0x3FFFFFFFF you'd have applications code starting at 0x40000000 with application data above the application's code. Then, if the kernel happens to be from 0x00000000 to 0x1FFFFFFFF would you have the application at 0x40000000 with the application's data above this and wasted space from 0x20000000 to 0x3FFFFFFFF, or would you have a fragmented system with data above the applications code and below it? How about if the kernel grew and used from 0x00000000 to 0x7FFFFFFFF - would you still be able to run applications that are designed to be at 0x40000000?
carbonBased wrote:Apps should be position independent, anyway, imo.
IMHO the 80x86 CPU is not designed for 32 bit position independant code (at least not without using segmentation), and therefore all attempts at making it run 32 bit position independant code are ugly hacks. I don't like ugly hacks, and I don't agree that all applications should be ugly hacks (even if your compiler hides these hacks, they still exist).
carbonBased wrote:3. If your OS also supports 64-bits, 32-bit applications will be able to use the full 32-bit address space in the 64-bit version.
This seems reasonable... except that if a 32-bit app needs to access any of the kernel it will need to be mapped into its address space, and therefore will take away from the full 32-bit address space just like before (yes, yes, callgates and other slow mechanisms can get rid of this, but...). Sure, it's possible to shift a lot outside of the 32-bit address space, but feasibly, I don't think you can get rid of it all.
If the OS is designed well it's easy to remove all of the kernel from the 32 bit part of the address space. Problems come from a badly designed ABI - for e.g. allowing (or expecting) applications to access kernel data directly would cause problems (but then you've got problems with any design change that effect the structure or location of this data, and the kernel can't safely modify the data in a multi-CPU environment).
Let's consider this from the opposite perspective - is there any benefit from having the kernel in the lower part of the address space?
The only benefit I can think of is that it makes it easy for people to pretend they are writing an OS (e.g. slapping a "hello world" kernel on top of GRUB and then having a party to celebrate). Maybe I've missed something...
Cheers,
Brendan