AMX 86 Frozen Dessert Maker User Manual


 
152
K
A
DAK
Advanced Topics
13.3 Task Scheduling Hooks
AMX does not provide direct support for specific hardware extensions such as a math
coprocessor or a memory management unit. Instead, AMX allows a set of application
procedures to be connected to its Task Scheduler. These procedures can save and restore
hardware dependent parameters specific to your application whenever a task switch
occurs.
There are four critical points within the AMX Task Scheduler. These critical points
occur when:
a task is started
a task ends
a task is suspended
a task is allowed to resume.
AMX allows a unique application procedure to be provided for each of these critical
points. Pointers to your procedures are installed with a call to procedure ajhook. You
must provide a separate procedure for each of the four critical points. Since these
procedures execute as part of the AMX Task Scheduler, their operation is critical. These
procedures must be coded in assembler using techniques designed to assure that they
execute as fast as possible.
The AMX Task Scheduler calls each of your procedures with the same calling
conventions.. Your procedures must be coded as FAR procedures.
Upon entry to your scheduling procedures, the following conditions exist:
Interrupts are disabled and must remain so.
DS:SI A(Task Control Block)
SS:SP Task stack free for use
AX,BX,CX,DX,ES Free for use
All other registers must be preserved.
Register pair
DS:SI gives you a pointer to the Task Control Block of the task which is
being started, ended, suspended or resumed. Your procedures are free to use the task's
stack. However, you must not attempt to use this stack to save information. For instance,
popping the return address, pushing parameters onto the stack and then returning to AMX
is not allowed.
If you have to save information as part of the task's state, you should use the storage in
the Task Control Block reserved for the private use of your application (see Chapter
3.12). If necessary, provide an extension to your Task Control Block and install a pointer
to the extension in the portion of the Task Control Block reserved for your use.
Once your procedures are installed, you will observe a degradation in the AMX task
switching performance. Each call to your procedure will add the setup and calling
overhead plus the time it takes your procedure to execute.