3/24/97 5-3 Multi-tasking
Protected Features in the XA
Table 5.1: Segment and Stack Register Protection
Note 1: The MSB of SSEL (bit 7) selects whether write through ES is allowed in User mode.
However, this bit is accessible only in System mode.
Table 5.2: PSW bit protection
In addition to the above, the System Stack is protected from corruption by User Mode execution
of the RETI instruction. If User Mode code attempts to execute that instruction, it causes an
exception interrupt. If it is necessary to run TRAP routines, for instance, in User Mode, the User
RETI exception handler can perform the return for the User Mode code. To accomplish this, the
User RETI exception handler may pop the topmost return address from the stack (2 or 3 words,
depending on whether the XA is in Page Zero mode) and then execute the RETI.
Protection Via Data Memory Segmentation
In User/Application mode, each task is protected from all others via the separation of data spaces
(unless explicit sharing is planned in advance). If the address spaces of two tasks include no
shared data, one task cannot affect the data of another, but it can read any data in the full address
space. Code sharing is always safe since code memory may never be written
1
. An application
mode program is prohibited from writing the segment registers, thus confining the writable area
per an ill-behaved task to its dedicated segment. Most applications, which are not expected to
utilize multi-tasking or use external memory, do not require any protection. They will remain
after reset in system mode, and could access all system resources.
At any given instant, two segments of memory are immediately accessible to an executing XA
program. These are the data segment DS, where the stack and local variables reside, and the
extra segment ES, which may be used to read remote data structures. Restricting the
addressability of task modules helps gain complete control of system resources for efficient,
reliable operation in a multi-tasking environment.
Mode
Writeto
DS
Write
through
DS
Writeto
ES
Write
through
ES
Read
through
DS
Read
through
ES
Read
through
SSP
Writeto
SSP
Writeto
SSEL
bit 7
System Allowed Allowed Allowed Allowed Allowed Allowed Allowed Allowed Allowed
User Dis-
allowed
Allowed Allowed Select-
able
1
Allowed Allowed Not
possible
Not
possible
Dis-
allowed
Mode
Write to SM
bit
Write to RS0:1
bits
Write to TM bit
Write to IM0:3
bits
System Allowed Allowed Allowed Allowed
User Disallowed Allowed Disallowed Disallowed
1. True for non-writable code memory only like EPROM, ROM, OTP. This might change for FLASH parts.