[Main menu]

Maverick Application Interface

Application Enviroment


It's really quite simple

When an application is loaded by the operating system (why it was loaded is irrelevant), its enviroment is nearly always the same. It only changes if the application is loaded on another architecture (ex. 16 bit Intel x86, Alpha or PowerPC).


The Basic Enviroment

As a minimum, the basic enviroment contains a codesegment, a stacksegment and a system datasegment. Each loaded respectfully to CS, SS and DS registers. The other segment registers contain the null-selector and thus can't be accessed, without triggering an access-violation. The general purpose registers all contain the value 0 (zero).

This was the basic enviroment, but an executable application file may also contain other code- and data-segments. These segments are loaded into their defined selectors (as defined in the file header).

The Primary Code Segment

This is the main code segment from the application file. The segment will be executable and readable but not writable. The first instruction is executed from address 0h (EIP = 0x00000000h).

The Stack Segment

The system will set up one stack for use by the task. Additional tasks may be created by the system for internal use, but all this would be transparent to the user task.

The length of the stack segment is variable. Its length is decided by the system, and the size is passed on through the data segment.

The System Data Segment

The data segment contains some start-up values and pointers. The length of this segment is variable depending on the amount of information the system generates. In the MAPI in version 0.1, the data segment would have the following structure:

Structure of the system data segment
OffsetSizeDescription
0000h - 0003h4Offset for the commandline string
0004h - 0007h4
0008h - 000Bh4
000Ch - 000Fh4
0000h - 0003h4
0004h - 0007h4
0008h - 000Bh4
000Ch - 000Fh4
0000h - 0003h4
0004h - 0007h4
0008h - 000Bh4
000Ch - 000Fh4


Possible System Messages

The system can also send messages to the process. The reason may be to notify it about a change in the system state, ex. new hardware added or removed or a future system shutdown.

The message will kindly be placed on the process' message queue (in the front), and the process will be queued for execution. When the process in dispatched, a well-behaved application would check the message queue, and get the system message. It should now act accordingly. If not, the system may take more drastic measures in use.

This following this is short description of the possible messages which the application should respond to:

Possible System Messages
IDMessage NameDescriptions
update_function_id_dbFunction id database has been updated.
shutdownSystem shutdown imminent. Close as quickly as possible.
new_active_taskThere is a new active task which should get input.