setjmp/longjmp on mips/ultrix4

Robert S. Thau rst at ai.mit.edu
Mon Oct 19 12:13:39 PDT 1998


Godmar Back writes:
 > 
 >  Sounds like the Sparc/Linux problem where longjmp tests that you don't 
 > use it for "illicit" purposes. You'll probably have to end up writing 
 > your own setjmp/longjmp/context switch routine.  
 > 
 > 	- Godmar

There may be alternatives to writing your own setjmp/longjmp.  On AIX,
some time back, I was faced with a similar problem; longjmp branched
to a routine, longjmperror, if it detected that it was being used
"illicitly".  However, it allowed you to supply your own
longjmperror() routine if you didn't like the behavior of the one in
the library (which aborted the program), so I was able to supply a
one-instruction longjmperror() routine which branched back into the
middle of longjmp(), which effectively patched out the bug check:

  .globl ._longjmp
  .globl .longjmperror
  .longjmperror: b ._longjmp+28

Of course, when the library code for longjmp() changes, this vile hack
has to change as well, so a hack like this makes you dependant on the
libraries; on the other hand, code like Kaffe which manipulates
jmp_buf contents is already dependant on jmp_buf layout.  On the other
hand, it's a quick and dirty way to get something going if you aren't
all that comfortable with assembler.

rst



More information about the kaffe mailing list