Services and Modeling for Embedded Software Development
Embecosm divider strip
Prev  Next

4.2.2.  setjmp Buffer Size

The implementation of setjmp and longjmp made use of a buffer to hold the machine state. The size of that buffer is architecture dependent and specified within the newlib directory in libc/include/machine/setjmp.h.

The header specifies the number of entries in the buffer and the size of each entry (as a C type). So for the OpenRISC 1000  we use the following.

#if defined(__or32__)
/* Enough space for all regs except r0 and r11 and the status register */
#define _JBLEN 31
#define _JBTYPE unsigned long
#endif
	  

As before, the definition is within a conditional, so it is only used when the target is the OpenRISC 1000  32-bit architecture.

The type jmp_buf used with setjmp and longjmp is then defined as:

typedef	_JBTYPE jmp_buf[_JBLEN];
	  
Embecosm divider strip