NEXSM is an extension of the XSM architecture with a dual-core feature. The machine has two identical cores with the same set of internal registers sharing a common memory. All registers in XSM are present in both the cores. Additionally, NEXSM cores contain an extra register called the core flag. A few additional privileged instructions provide primitives for synchronization between the two cores. One of the processors is called the primary core and the other called the secondary core. The machine can operate in two modes – active mode and reset mode. In the reset mode, the secondary is non-functional. The mode in which the machine operates can be controlled by the primary using a pair of special privileged instructions – START and RESET.
The only additional register in NEXSM that is not present in XSM is the core flag (CORE). The core flag is a read-only machine register. The contents of the core flag are set to 0 in the primary core and 1 in the secondary core. The core flag allows a program to test whether it is currently executing in the primary or the secondary.
Usage Example: JZ CORE, [Address] /** Tests the value of CORE and branches **/
Note: The START instruction is ignored if executed in active mode. Similarly, the RESET instruction is ignored when executed in reset mode.
NEXSM machine has 144 memory pages (as against 128 pages of XSM). The memory organization of pages 0 to 127 are exactly as in XSM. The organization of the remaining 16 pages are as:
NEXSM has 16 additional free blocks of disk space, with block numbers 512 to 527.
1. Test and Set Lock
Syntax: TSL Rj, [loc]
Semantics: The contents of the memory location [loc] is copied to register Rj. The value of [loc] is set to 1. This instruction is atomic. That is, when one of the cores is executing the TSL instruction, the memory bus is locked to avoid the other processor from simultaneously accessing [loc].
2. Dual-core initialization
Syntax: START
Semantics: If this instruction is executed by the primary while the machine is in reset mode, then secondary core starts parallel execution at the starting address of memory page 128 (physical address 65536). The START instruction is ignored if executed when the machine is in active mode.
3. Reset instruction
Syntax: RESET
Semantics: The instruction, when executed in active mode sets the machine to reset mode. The instruction is ignored if executed in reset mode.
The way NEXSM machine enters privileged mode is similar to XSM. Switch from unprivileged mode to privileged mode happens only when a software/hardware interrupt or exception occurs. The following are the details.