09.06.2013 Views

Intel XENIX 286 Programmers Guide (86) - Tenox.tc

Intel XENIX 286 Programmers Guide (86) - Tenox.tc

Intel XENIX 286 Programmers Guide (86) - Tenox.tc

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>XENIX</strong> Programming Programm ing Commands<br />

CC (continued)<br />

Memory Models<br />

cc can create programs for four different memory models: small, middle, large, and<br />

huge. In addition, small model programs can be pure or impure.<br />

Impure-Text Small Model<br />

These programs occupy one 64K -byte physical segment in which both text<br />

(machine instructions) and data are combined. By default, cc creates impure<br />

small model programs. They can also be created using the -Ms option.<br />

Pure-Text Small Model<br />

These programs occupy two 64K -byte physical segments. Text and data are in<br />

separate segments. The text is read-only and may be shared by several<br />

processes at once. The maximum program size is 128K bytes. Pure small model<br />

programs are created using the -i flag when linking small model programs.<br />

Middle Model<br />

These programs occupy several physical segments when linked, but only one<br />

segment contains data. A text segment is allocated per source module, but all<br />

data segments are combined. Special calls and returns are used to access<br />

functions in other segments. The total amount of text can be any size. Data<br />

must not exceed 64K bytes. Middle models programs are created using the -Mm<br />

·<br />

option. These programs are always pure.<br />

Large Model<br />

These programs occupy several physical segments with both text and data in as<br />

many segments as required. Text is handled as in middle model. Special<br />

addresses are used to access data in other segments. Text and data may be any<br />

size, but no data item may be larger than 64K bytes. Large model programs are<br />

created using the -Ml option. These programs are always pure.<br />

Huge Model<br />

These programs occupy several physical segments with both text and data as in<br />

large model, but arrays may span segments, allowing them to be larger than 64K<br />

bytes. Arrays which span more than two segments (128K bytes) must contain<br />

elem ents whose size in bytes is a power of two. Huge model programs are<br />

created using the -Mh option. These programs are always pure.<br />

Small and middle model object files can be linked only with object files and libraries of<br />

the same model. Large and huge model object files can be linked only with large and<br />

huge model object files and libraries. You cannot combine small, medium, and<br />

large/huge model object files into one executable program. cc automatically selects the<br />

correct small, middle, or large versions of the standard libraries based on the<br />

configuration option. It is up to you to make sure that all of your object files and<br />

private libraries are properly compiled in the appropriate model.<br />

The special calls and returns used in middle and large model programs may affect<br />

execution time, particularly if frequent calls are made to very short routines.<br />

8-25

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!