Node:C Code restrictions, Next:, Previous:C Code Macros, Up:Simple instructions



C Code restrictions

Vmgen generates code and performs some optimizations under the assumption that the user-supplied C code does not access the stack pointers or stack items, and that accesses to the instruction pointer only occur through special macros. In general you should heed these restrictions. However, if you need to break these restrictions, read the following.

Accessing a stack or stack pointer directly can be a problem for several reasons:

You should access the instruction pointer only through its special macros (IP, SET_IP, IPTOS); this ensure that these macros can be implemented in several ways for best performance. IP points to the next instruction, and IPTOS is its contents.