Help needed for small assembler script for the iraf package
Dear MIPS 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.
For the 32 bit platforms, I asked this already 3 years ago [2], and got
an implementation by David Kuehling:
-------------------------------8<-----------------------------------
.file "zsvjmp.s"
# Copyright (c) 2014 David Kuehling <dvdkhlng AT posteo TOD de>
# Distributable under the same license as IRAF
# This file contains the Linux mipsel version of ZSVJMP for Debian.
.set mips1
.abicalls
.text
.global zsvjmp_
.ent zsvjmp_
.type zsvjmp_, %function
zsvjmp_:
.set noreorder
.cpload $t9
.set reorder
sw $a1, 0($a0) # buf[0]=status
sw $zero, 0($a1) # *status=0
addiu $a0, $a0, 4 # &buf[1] --> 1st arg for sigsetjmp
move $a1, $zero # 2nd arg is zero
# this call sequence is required when used inside shared library
la $t9, __sigsetjmp
j $t9
## note: no delay slot, filled by GAS
.end zsvjmp_
-------------------------------8<-----------------------------------
The "zdojmp" counterpart is a portable C function.
I created a small repository [3] 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
mips64el. Maybe someone could help me here? Preferably under the IRAF
license [4], so that it can be included upstream later.
There is no direct request from the users to have this ported to
mips64el. However, it would be nice to have IRAF running on as much
Debian platforms as possible.
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://lists.debian.org/debian-mips/2014/05/msg00017.html
[3] https://github.com/olebole/zsvjmp
[4] https://github.com/iraf/iraf-v216/blob/master/local/COPYRIGHTS
Reply to: