Help needed: small piece of assembler code for IRAF
Dear m68k enthusiasts,
I am the maintainer of the "iraf" package [1]. Although most of the code
is portable, it needs one piece of assembler code for each platform that
provides a (sort of) setjmp for FORTRAN.
A "C" implementation for this looks like:
#include <setjmp.h>
int zsvjmp_( long *buf, long *status ) {
*status = 0;
((long **)buf)[0] = status;
return sigsetjmp ((void *)((long **)buf+1),0);
}
however this does not work, since the "sigsetjmp" call needs to be
replaced by a jump to sigsetjmp instead.
As IRAF is a 40-year old package, there was already some assembler that
was used ~35 years ago [2]:
-------------------------------8<-----------------------------------
.proc
.import setjmp
.export zsvjmp
.callinfo
zsvjmp
;
; save address to status word in jmp_buf[0]
;
stw arg1,0(0,arg0)
ldi 0,1
stws 1,0(0,arg1)
;
; call setjmp with jmp_buf[1]..jmp_buf[51]
;
addi 4,arg0,arg0
b setjmp
nop
;
; setjmp will return directly to the caller of zsvjmp at this
; point, so the next statement will never be reached.
;
nop
.procend
-------------------------------8<-----------------------------------
However, just including this does not work because assembler syntax
changed [3].
I created a small repository [4] that contains the assembler I collected
so far as well as two test programs.
As I am not familiar with HP assembler I have no idea how to adopt the
assembler code. Maybe someone could help me here? Preferably under the
IRAF license [5], so that it can be included upstream later.
One way that worked for other platforms was to compute the C snipped
above (having the sigsetjmp function name by something else) with an
optimizing compiler.
There is no request from the users to have this ported to hppa, and I
doubt that ever will. My main motivation to get it ported is to check
the package for hidden problems on "unusual" architectures.
Best regards
Ole
[1] https://tracker.debian.org/pkg/iraf
[2]
https://github.com/iraf-community/iraf/blob/v2.16.1/unix/portkit/zsvjmp.s.HP800
[3]
https://buildd.debian.org/status/fetch.php?pkg=iraf&arch=hppa&ver=2.18.1%7Erc1-3%7E2&stamp=1726682218&raw=0
[4] https://github.com/olebole/zsvjmp
[5] https://iraf-community.github.io/COPYRIGHT.html
Reply to: