• Help needed for small assembler script for the iraf package

    From Ole Streicher@21:1/5 to All on Thu Jan 4 11:40:02 2018
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From James Cowgill@21:1/5 to Ole Streicher on Thu Jan 4 14:40:02 2018
    Copy: debian-mips@lists.debian.org

    This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --3nIhrBEF1F22xVCM4ob1jsQiiEe8alcjl
    Content-Type: multipart/mixed;
    boundary="------------35DDC77C4EE985123B5CDDB3"
    Content-Language: en-US

    This is a multi-part message in MIME format. --------------35DDC77C4EE985123B5CDDB3
    Content-Type: text/plain; charset=utf-8
    Content-Transfer-Encoding: quoted-printable

    Hi,

    On 04/01/18 10:22, Ole Streicher wrote:
    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:

    [...]
    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.

    I think the attached code will work for all MIPS variants (32-bit and
    64-bit). To do this it uses some headers from glibc and therefore needs
    to be compiled using "gcc" instead of "as" (arguably userspace apps
    should never use "as" directly anyway).

    Thanks,
    James

    --------------35DDC77C4EE985123B5CDDB3
    Content-Type: text/plain; charset=UTF-8;
    name="zsvjmp-mips.S"
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment;
    filename="zsvjmp-mips.S"

    I2luY2x1ZGUgPHN5cy9hc20u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kzAOLifdHmcuGt/YHW5Yax0K6oh4olL1D7M3cu2Gq0xXznBbPGz3rG q6oh1wNrwRJUjdXbtpf8/ZPW5zpnql5I90xIp5iG5gxrxQDJLx/mpT9oEY0jgtMQ 1OPkYPSKc9uji48MbMCBIatEBYw8dhrpD8MnUhl199Y8+989qN7yBfcseTQue8ph HyittIRipCrkHaDzT+RC1Fh3zvMku0QSYSLBni4CW7meCm23L2ur0mpF/yXtS+w2 i1KzW2b/FemGNDeDjiTgGW8eL8eEVVPh+iMJ7DIRART2vtl8puuk8SZ/T661BLIa heKCUwbaeHEDsd71gXx4waq8fRd8fOYsWMcvDAbWcLvj+MfVR6PRwzcX0vFcmjle XHGPX4ZYL5YfHVNno27iFe5y0KM1Diqh4hOq164m+rmOt8VnlpVznQxpke8juclc PZ25L4Wb3/XPUwwLGMk+tr3VbB1l35L5ZxuUCAzZ3k3BIcCJN4MPbi4PZmOSRQUD a0PsdUAYaq0/eySoB2ij/k/1SWYF/S2yhuSdKfp9KbCNa2YjJt4ZPfaWD01m4PXf telMjL7DSSJwRK8W9FJ3orrw0jYdvYvI/rbSC7o6+afSdhLwAS8=
    =YATS
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ole Streicher@21:1/5 to James Cowgill on Fri Jan 5 17:00:01 2018
    Hi James,


    On 04.01.2018 14:38, James Cowgill wrote:
    I think the attached code will work for all MIPS variants (32-bit and 64-bit). To do this it uses some headers from glibc and therefore needs
    to be compiled using "gcc" instead of "as" (arguably userspace apps
    should never use "as" directly anyway).

    thank you very much! This works well (tested only on mips64el however),
    and I included it in the source. Now, only ppc64el code is needed :-)

    Best regards

    Ole

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)