Offset Contains
0 Start code (usr mode)
4 Initialise code (svc mode)
8 Finalise code (svc mode)
12 Service handler (svc or irq mode)
16 Title String
20 Help String
24 Help/Command table
28 SWI base number
32 SWI handler (svc mode)
36 SWI name table
40 SWI decode code (svc mode)
44 MessageTrans file (3.60+)
48 Flags word (5.00+)
All entries except +28 are offsets from the start of the module. Entries of 0, or those outside the module will be ignored. This means that a 26 bit module with no SWIs could use the last six words for something else, though any modules requiring the flags word at +48 will need to pad to that point with zeros.
String offsets have byte alignment, except for the MessageTrans file which must be word aligned to be considered valid.
Try not to store data in the body of your module; allocate workspace and store the pointer in the private word. The OS lets module code be re-used (multiply instantiated) to allow several copies of the module to run at once, and several copies would be storing different data in the same locations in the module code. If this causes your module to crash because it has been multiply instantiated, it is your module's fault, not the OS' or the user's.
Footnote for pedants
If the value for start code doesn't represent a valid non-zero offset, it is taken to be a literal ARM instruction (which hopefully is a branch to the right place). This can be used to branch to a stub which calls OS_WriteEnv before branching back into the module, which is useful during testing.
|
|
|