Zilog ZUSBOPTS Manual de usuario Pagina 214

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 520
  • Tabla de contenidos
  • SOLUCIÓN DE PROBLEMAS
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 213
Stack Pointer Overflow UM017105-0511
186
Zilog Developer Studio II – ZNEO™
User Manual
The interrupt status, which is returned from TDI(), consists of the flags register extended
to 16 bits for efficient stack storage.
This function is an intrinsic function and is inline-expanded by default. If the
–redu-
ceopt
compiler option is selected, then this function is not inline-expanded and is imple-
mented as a regular function instead.
Synopsis
#include <zneo.h>
intrinsic unsigned short TDI(void);
Example
#include <zneo.h>
void main(void)
{
unsigned short istat;
istat = TDI(); /* Test and Disable Interrupts */
/* Do Something */
RI(istat); /* Restore Interrupts */
}
Stack Pointer Overflow
The run-time library for the ZNEO C-Compiler manipulates the SPOV register to protect
program and allocated data. The default action is:
The SPOV register is initialized to the end of the initialized data segment. Therefore,
if the Stack Pointer is decremented below SPOV, it results in the Stack overflow
exception.
When malloc() is called, the SPOV register is increased to the highest address of
allocated data;
malloc() returns NULL if changing the SPOV results in an immedi-
ate stack overflow.
Calling free() returns memory for possible use by malloc() but does not return
memory for possible use as stack; that is, the SPOV register is not updated.
However, if you modify the SPOV register directly, malloc() leaves SPOV where
you have put it and does not allocate data on the stack side of SPOV.
The run-time library does not supply a handler for the stack overflow exception (or any
other exception). If there is any possibility of your released application overflowing its
stack, you must decide how to recover from the situation and write your own handler.
Vista de pagina 213
1 2 ... 209 210 211 212 213 214 215 216 217 218 219 ... 519 520

Comentarios a estos manuales

Sin comentarios