Jameco Electronics 2000 Network Card User Manual


 
User’s Manual 289
B.1.6 Stack Protection
Stack overflow and underflow can now be detected. Low and high stack limits can be set
on 256-byte boundaries. When a stack-relative memory access occurs within 16 bytes of
these limits (or outside of them), a new Priority 3 stack violation interrupt occurs. The 16-
byte buffer exists to allow stack protection even if the stack is placed against a memory
segment boundary.
Figure B-2 shows one possible stack layout. A 2048-byte stack is set up by setting
STKHLR to 0xE0, STKLLR to 0xD8, and SP to 0xDFF0. Any stack-relative memory
accesses above 0xDFEF (i.e., stack underflow) or below 0xD810 (i.e., overflow) would
trigger the stack violation interrupt.
Figure B-2. Simple Stack Protection Layout
Stack access in this
region triggers an
interrupt
Stack access in this
region triggers an
interrupt
Stack access in this
region is allowed
0xE000
0xDFF0
0xDFEF
0xD810
0xD80F
0xD800
TKHLR = 0xE0
TKLLR = 0xD8