Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

include/setjmp.h File Reference

Non-local goto as specified in ANSI C. More...

#include <config.h>

Include dependency graph for setjmp.h:

Include dependency graph

Go to the source code of this file.

Typedefs

typedef int jmp_buf [6]
 Information stored for non-local jumps.


Functions

int setjmp (jmp_buf env)
 Save execution context for non-local goto.

void longjmp (jmp_buf env, int val)
 Non-local jump to saved machine context.


Detailed Description

Non-local goto as specified in ANSI C.

Author:
Torsten Landschoff <tla@informatik.uni-kiel.de>

Definition in file setjmp.h.


Typedef Documentation

typedef int jmp_buf[6]
 

Information stored for non-local jumps.

Stores the machine status for non-local jumps. The H8/300 CPU has the following state information:

  • 8 registers of 16 bit each (r0, r1, ..., r7)
  • the program counter
  • a condition code register of a single byte To allow execution of a longjmp we have to return to the state saved in a jmp_buf just like from a subroutine invocation. The machine description of gcc for the H8 says that r0,r1,r2,r3 are destroyed by a subroutine call. Therefore we need to save the condition code, the program counter of the caller (where we want to return), and the registers r4, r5, r6, r7. We are using 6 words for that and ignore a byte at restore time.

Definition at line 48 of file setjmp.h.


Function Documentation

void longjmp jmp_buf  env,
int  val
 

Non-local jump to saved machine context.

Restores a machine context as saved via setjmp.

Parameters:
env the buffer of the saved machine status
val the value to return from the setjmp function

int setjmp jmp_buf  env  ) 
 

Save execution context for non-local goto.

Records the current machine status for a non-local goto. The saved status will be invalidated when returning from the stack frame where it was set.

Parameters:
env buffer for saved machine status
Returns:
0 when returning directly (after saving the state), or whatever was given to longjmp when returning via a non-local goto


brickOS is released under the Mozilla Public License.
Original code copyright 1998-2002 by the authors.

Generated on Mon Feb 16 21:01:55 2004 for brickOS C by doxygen 1.3.5