Dear arm64 specialists,

I just got the "IRAF" package accepted into Debian [1]. Although the
code is claimed to be portable, it needs a piece  of assembler
code for each platform that provides a (sort of) setjmp() to their
Fortran variant.

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.

I already wrote that code for the arm 32 bit platforms, which looks like
this:

-------------------------------8<-----------------------------------
        .file   "zsvjmp.s"
        .arch armv6
        .text
        .global zsvjmp_
        .type   zsvjmp_, %function
zsvjmp_:
        mov     r2, #0         @
        str     r2, [r1, #0]   @ *status = 0
        str     r1, [r0, #0]   @ buf[0] = status
        add     r0, r0, #4     @ &buf[1] --> 1st arg for sigsetjmp
        mov     r1, #0         @ 0       --> 2nd arg for sigsetjmp
        b       __sigsetjmp    @ call sigsetjmp
-------------------------------8<-----------------------------------

The "zdojmp" counterpart is a portable C function.

I created a small repository [2] that contains the assembler I collected
so far as well as two test programs. The function of the Fortran test
program is still not so important since IRAF uses its own Fortran
calling interface.

However, I have no idea how to write the same for the 64-bit platform
arm64 (the code in the repo does not work). Maybe someone could help me
here? Preferably under the IRAF license [3], so that it can be included
upstream later.

The arm platforms are specifically important for IRAF, since the package
is also used by semiprofessional astronomers who use a Raspberry Pi (and
similar) as observation platform, and there is some request to have IRAF
available there.

Best regards

Ole

[1] https://tracker.debian.org/pkg/iraf
[2] https://github.com/olebole/zsvjmp
[3] https://github.com/iraf/iraf-v216/blob/master/local/COPYRIGHTS

Reply via email to