News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

48-bit FAR pointers

Started by thomas_remkus, March 06, 2008, 03:55:12 AM

Previous topic - Next topic

thomas_remkus

I thought that in protected mode with flat memory there wasn't a concern about NEAR or FAR pointers. Am I crazy and I need to code for NEAR and FAR pointers in MASM?

BogdanOntanu

Normally in Windows in 32 bits flat memory protected mode you can not or should not use 48 bits "far pointers". Of course the CPU can use them but they are useful only for the OS kernel and not for user mode applications.
Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

farklesnots

thomas -

In the flat memory model the segment registers point to the same place (except for FS, which the Windows kernel uses internally for stack information). We can view the entire 4-Gig address space as one big segment, whether we're programming Ring-3 apps or Ring-0 drivers. This is one of the reasons why programming for 32-bit Windows is MUCH easier than programing for 16-bit Windows was. As Bogdan said, we shouldn't mess with the segment registers in Windows programming because that would mess up the whole memory model. The 386 forms of Unix (Linux, FreeBSD, etc.) also use a flat memory model. I don't know if they do anything special with FS or GS.

MichaelW

QuoteAm I crazy and I need to code for NEAR and FAR pointers in MASM?

You need to code for 32-bit NEAR pointers, but since this is the default for the flat memory model there is no need to specify NEAR PTR.
eschew obfuscation