Just to keep this thread up to date, this discussion moved to githut, where Rogério, Gustavo and I experienced some ideas and created a proposed solution.
https://github.com/leitao/zsvjmp On 01/04/2018 08:16 AM, Ole Streicher wrote: > Dear powerpc 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 have some code for the ppc 32 bit (linuxppc) platform from > august 2000 in the original distribution: > > -------------------------------8<----------------------------------- > .file "zsvjmp.s" > .section ".text" > .align 2 > .globl zsvjmp_ > .type zsvjmp_, @function > zsvjmp_: > # R3 = buf, R4 = &status > li 11,0 # > stw 11,0(4) # *status = 0 > stw 4,0(3) # buf[0] = status > addi 3,3,4 # &buf[1] --> 1st arg for sigsetjmp > li 4,0 # 0 --> 2nd arg for sigsetjmp > b __sigsetjmp@PLT > .size zsvjmp_,.-zsvjmp_ > .section .note.GNU-stack,"",@progbits > > -------------------------------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. > > However, I have no idea how to write the same for the 64-bit platform > ppc64el. Maybe someone could help me here? Preferably under the IRAF > license [3], so that it can be included upstream later. > > There is no direct request from the users to have this ported to > ppc64el. However, it would be nice to have IRAF running on as much > Debian platforms as possible; and maybe someone wants to run it on an > IBM BlueGene or so... > > Big Endian systems are a different story; the current version seems to > have some problems on such machines, so there will be no Debian package > for those in the moment. > > 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 > >

