Page 1 of 1

Flat memory on 64-bit

Posted: Mon Aug 31, 2009 8:58 am
by mschummi
What do I have to set to have a 64-bit environment with a flat memory model, no paging and "no segmentation"?

When I search for switching to long mode, I can only find information for people that already have paging enabled.

Re: Flat memory on 64-bit

Posted: Mon Aug 31, 2009 9:00 am
by whowhatwhere
mschummi wrote:I'd like
What do I have to set to have a 64-bit environment with a flat memory model, no paging and "no segmentation"?

When I search for switching to long mode, I can only find information for people that already have paging enabled.
It's automatically in a flat memory model, assuming you've set up long mode properly. When you set LME bit and enable paging, you are in long mode.

Re: Flat memory on 64-bit

Posted: Mon Aug 31, 2009 9:07 am
by mschummi
So, can't I switch to long mode without having paging enabled?

Re: Flat memory on 64-bit

Posted: Mon Aug 31, 2009 9:12 am
by whowhatwhere
mschummi wrote:So, can't I switch to long mode without having paging enabled?
Yes, exactly. For better or for worse, AMD engineers are ... brilliant.

Re: Flat memory on 64-bit

Posted: Mon Aug 31, 2009 1:48 pm
by Kitsune
Just to add what was already said, but 64 bit mode doesn't have segmentation to begin with.



Edit: Didn't realize that the compatibility modes were considered a sub mode of long mode!

Re: Flat memory on 64-bit

Posted: Mon Aug 31, 2009 2:28 pm
by Brendan
Hi,
Kitsune wrote:Just to add what was already said, but long mode doesn't have segmentation to begin with.
In long mode there's 2 sub-modes. There's the 64-bit sub-mode (which has no segmentation, except for FS and GS), and the "compatibility" sub-mode that allows you to run 32-bit and 16-bit software (which has full segmentation).

@mschummi: If you don't want to take advantage of paging (e.g. to improve performance, reduce RAM usage and simplify the address space/s) then you could just identity map everything. There's also other beneficial features you can disable or ignore (caches, FPU/MMX, SSE, etc) if you really want to ensure your OS is inefficient. ;)


Cheers,

Brendan