Someone can tell me setjmp / longjmp in Assembly?

It is smart functions in C

Thank you for reading!
Have a nice day!
Posted on 2002-08-14 06:48:23 by nyam
MASM does jump extension automatically so unless you have a reason to specify SHORT for a jump which restricts it to signed BYTE range, lust make the jump to the label you want.

Regards,

hutch@movsd.com
Posted on 2002-08-14 09:59:58 by hutch--

Someone can tell me setjmp / longjmp in Assembly?

It is smart functions in C


I'd say, it is a kludge to work around the inherent limit of C.
If you are thinking of something like passing an argument to a signal handler, use a register to do it.
If you are thinking of something like jmp to several different locations, use a global variable which holds the target address and indirect jmp there.
Posted on 2002-08-14 16:48:08 by Starless
setjmp/longjmp allows to jump inside another function, so just to use the ASM jmp instruction will not work. Look in header file SETJMP.H. There you may find the registers to save (esi, edi, ebx, ebp, esp, eip). The "trylevel" and unwind function you can possibly ignore (as long as you dont mix your asm code with C++ code)

The longjmp() restore code should be simple to implement. :)

As you may know, you can call longjmp only as long as you haven't exited the function calling setjmp() because stack frame would be invalid afterwards.
Posted on 2002-08-15 01:44:38 by japheth