Program counter overflow, Stack overflow, Program counter overflow stack overflow – Zilog Z16F2810 User Manual
Page 66: Protection. for more details, see the
System Exceptions
UM018809-0611
50
ZNEO
®
CPU Core
User Manual
Program Counter Overflow
The Program Counter Overflow exception can be used to restrict program execution to the
memory space below a certain address. On each instruction fetch, the 32-bit PC value is
compared to the value in the Program Counter Overflow register (PCOV) in I/O memory.
If the PC value is greater than the PCOV value, a Program Counter Overflow system
exception is generated after the instruction fetch completes. After a Program Counter
Overflow occurs, the
PCOVF
bit in the System Exception register in I/O memory (SYS-
EXCP) is set to 1. After the first PCOV exception has executed, no additional PCOV
exceptions are generated until the
PCOVF
bit is cleared. Writing 1 to the
PCOVF
bit clears
the bit to 0.
For detailed information regarding the System Exception register (SYSEXCP), refer to the
ZNEO product specification that is specific to your device .
The IRET instruction must not be used to end a PCOV exception service routine. After
a PCOV exception occurs, the Program Counter value on the stack points to an address
following the presumably invalid instruction that was fetched.
To set up Program Counter Overflow Protection, initialize PCOV to the highest address
that you intend to use for program instructions.
Stack Overflow
The Stack Overflow exception can be used to help restrict stack growth to the memory
space above a certain address. Whenever the register R15 Stack Pointer (SP) is changed,
its value is compared to the value in the Stack Pointer Overflow register (SPOV) in I/O
memory. If the SP value is less than the SPOV value, a Stack Pointer Overflow system
exception is generated after the current instruction completes.
After a Stack Pointer Overflow occurs, the
SPOVF
bit in the System Exception register in
I/O memory (SYSEXCP) is set to 1. After the first SPOV exception has executed, no addi-
tional SPOV exceptions are generated until the
SPOVF
bit is cleared. Writing 1 to the
SPOVF
bit clears the bit to 0.
For more information about the System Exception register (SYSEXCP), refer to the ZNEO
product specification that is specific to your device .
Note:
Caution:
Note: