************** TITLE: FLAT MEMORY MODEL ****************************************** * Title: flat memory model ********************* ================= translated from tutor by hutch = ====================== original: collect and packed by Dreamtheater ===== ** ====== 翻 h @ 小 from qdu huasoft @ 163.com ============ ** ==================================== ======= *************************************************** *************: flat memory model (FLAT MEMORY MODEL)
A program written in a local 32-bit Windows format is created by a so-called "flat memory model", which only has a segment containing code and data. This program must run on a 386 or higher processor.
Early 16-bit code, mixed by segment and offset addresses to address 64K (restrictions on segments). In contrast, the flat memory model only needs to be offset but there is 4G addressing range. This makes compilation easier to write, and the code will be a little faster.
Under such a flat memory model, all segment registers are automatically set to the same value, which means the segment / offset addressing mode must not be used to run 32-bit programs running on 32-bit Windows.
For programmers who have written under DOS, a 32-bit Windows PE executable is like a COM file under a DOS, and they have only one segment containing program code and data, and they use offset directly. Address, not segment / offset addressing mode.
The flat model procedure is Near code addressing and near data addressing, all within 4G.
The FS and GS segment registers are not used in ordinary programs, but they are used by some program instances of the operating system. ============================================================================================================================================================================================================= ======