Whatever.
authorJosh Yelon <jyelon@uiuc.edu>
Sat, 12 Jul 1997 10:01:58 +0000 (10:01 +0000)
committerJosh Yelon <jyelon@uiuc.edu>
Sat, 12 Jul 1997 10:01:58 +0000 (10:01 +0000)
src/QuickThreads/md/setjmp.c [new file with mode: 0644]
src/QuickThreads/md/setjmp_d.h [new file with mode: 0644]
src/QuickThreads/md/setjmp_u.h [new file with mode: 0644]
src/QuickThreads/md/t3e.h
src/QuickThreads/md/t3e.s
src/QuickThreads/mkfiles/aix32-gcc
src/QuickThreads/mkfiles/cray-t3e-cc [new file with mode: 0644]
src/QuickThreads/mkfiles/generic [new file with mode: 0644]
src/QuickThreads/mkfiles/t3e [deleted file]
src/QuickThreads/mkfiles/vax-cc [new file with mode: 0644]
src/arch/t3e/conv-mach.csh

diff --git a/src/QuickThreads/md/setjmp.c b/src/QuickThreads/md/setjmp.c
new file mode 100644 (file)
index 0000000..4ffcc51
--- /dev/null
@@ -0,0 +1,66 @@
+
+#include "qt.h"
+#include <setjmp.h>
+
+struct helpdesc { qt_helper_t *hfn; qt_t *jb; void *old; void *new; };
+
+#ifdef QT_GROW_DOWN
+#define SHIFTSP(pos) {char *osp=alloca(0); alloca((osp-((char*)pos))+256); }
+#else
+#define SHIFTSP(pos) {char *osp=alloca(0); alloca((((char*)pos)-osp)+256); }
+#endif
+
+static void qt_args_1(qt_t *rjb, void *u, void *t,
+                     qt_userf_t *userf, qt_only_t *only)
+{
+  jmp_buf jb; struct helpdesc *rhelp;
+  rhelp = (struct helpdesc *)setjmp(jb);
+  if (rhelp == 0) {
+    SHIFTSP(rjb);
+    longjmp((int*)rjb, (int)jb);
+  }
+  rhelp->hfn(rhelp->jb, rhelp->old, rhelp->new);
+  only(u, t, userf);
+  write(2,"Never get here 2.\n",18);
+}
+
+qt_t *qt_args(qt_t *sp, void *u, void *t,
+             qt_userf_t *userf, qt_only_t *only)
+{
+  jmp_buf jb; qt_t *result;
+
+  result = (qt_t*)setjmp(jb);
+  if (result==0) {
+    SHIFTSP(sp);
+    qt_args_1((qt_t*)jb,u,t,userf,only);
+    write(2,"Never get here 1.\n",18);
+  }
+  return result;
+}
+
+void *qt_block(qt_helper_t *hfn, void *old, void *new, qt_t *sp)
+{
+  struct helpdesc help, *rhelp; char *oldsp; int offs;
+  jmp_buf jb;
+  help.hfn = hfn;
+  help.jb  = (qt_t*)&jb;
+  help.old = old;
+  help.new = new;
+  rhelp = (struct helpdesc *)setjmp(jb);
+  if (rhelp==0) {
+    SHIFTSP(sp);
+    longjmp((int*)sp, (int)&help);
+  }
+  rhelp->hfn(rhelp->jb, rhelp->old, rhelp->new);
+}
+
+void *qt_abort(qt_helper_t *hfn, void *old, void *new, qt_t *sp)
+{
+  struct helpdesc help, *rhelp;
+  help.hfn = hfn;
+  help.jb  = (qt_t*)&help;
+  help.old = old;
+  help.new = new;
+  SHIFTSP(sp);
+  longjmp((int*)sp, (int)&help);
+}
diff --git a/src/QuickThreads/md/setjmp_d.h b/src/QuickThreads/md/setjmp_d.h
new file mode 100644 (file)
index 0000000..1b7dfcb
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * QuickThreads -- Threads-building toolkit.
+ * Copyright (c) 1993 by David Keppel
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation for any purpose and without fee is hereby
+ * granted, provided that the above copyright notice and this notice
+ * appear in all copies.  This software is provided as a
+ * proof-of-concept and for demonstration purposes; there is no
+ * representation about the suitability of this software for any
+ * purpose.
+ *
+ * Must define: QT_STKALIGN, QT_ARGS, QT_VARGS, QT_BLOCK, QT_BLOCKI, QT_ABORT
+ *
+ */
+
+#ifndef QT_GENERIC1_H
+#define QT_GENERIC1_H
+
+typedef unsigned long qt_word_t;
+
+#define QT_GROW_DOWN
+#define QT_STKALIGN    (8)   /* real alignment is done elsewhere */
+#define QT_STKBASE     (8)   /* this is a dummy constant */
+
+typedef struct qt_t qt_t1;
+typedef void *(qt_userf_t1)(void *pu);
+typedef void (qt_only_t1)(void *pu, void *pt, qt_userf_t1 *userf);
+typedef void *(qt_helper_t1)(qt_t1 *old, void *a0, void *a1);
+qt_t1 *qt_args(qt_t1 *,void *,void *,qt_userf_t1 *,qt_only_t1*);
+void *qt_block(qt_helper_t1 *, void *, void *, qt_t1 *);
+void *qt_abort(qt_helper_t1 *, void *, void *, qt_t1 *);
+#define QT_ARGS(sp,u,t,uf,on) (qt_args(sp,u,t,(qt_userf_t1*)(uf),(qt_only_t1*)(on)))
+#define QT_VARGS(sp,nb,vargs,pt,startup,vuserf,cleanup) (qt_error(),(void*)0)
+#define QT_BLOCK(help,old,new,sp) (qt_block(help,old,new,sp))
+#define QT_BLOCKI(help,old,new,sp) (qt_block(help,old,new,sp))
+#define QT_ABORT(help,old,new,sp) (qt_abort(help,old,new,sp))
+
+#endif /* ndef QT_GENERIC1_H */
diff --git a/src/QuickThreads/md/setjmp_u.h b/src/QuickThreads/md/setjmp_u.h
new file mode 100644 (file)
index 0000000..96848aa
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * QuickThreads -- Threads-building toolkit.
+ * Copyright (c) 1993 by David Keppel
+ *
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation for any purpose and without fee is hereby
+ * granted, provided that the above copyright notice and this notice
+ * appear in all copies.  This software is provided as a
+ * proof-of-concept and for demonstration purposes; there is no
+ * representation about the suitability of this software for any
+ * purpose.
+ *
+ * Must define: QT_STKALIGN, QT_ARGS, QT_VARGS, QT_BLOCK, QT_BLOCKI, QT_ABORT
+ *
+ */
+
+#ifndef QT_GENERIC1_H
+#define QT_GENERIC1_H
+
+typedef unsigned long qt_word_t;
+
+#define QT_GROW_UP
+#define QT_STKALIGN    (8)   /* real alignment is done elsewhere */
+#define QT_STKBASE     (8)   /* this is a dummy constant */
+
+typedef struct qt_t qt_t1;
+typedef void *(qt_userf_t1)(void *pu);
+typedef void (qt_only_t1)(void *pu, void *pt, qt_userf_t1 *userf);
+typedef void *(qt_helper_t1)(qt_t1 *old, void *a0, void *a1);
+qt_t1 *qt_args(qt_t1 *,void *,void *,qt_userf_t1 *,qt_only_t1*);
+void *qt_block(qt_helper_t1 *, void *, void *, qt_t1 *);
+void *qt_abort(qt_helper_t1 *, void *, void *, qt_t1 *);
+#define QT_ARGS(sp,u,t,uf,on) (qt_args(sp,u,t,(qt_userf_t1*)(uf),(qt_only_t1*)(on)))
+#define QT_VARGS(sp,nb,vargs,pt,startup,vuserf,cleanup) (qt_error(),(void*)0)
+#define QT_BLOCK(help,old,new,sp) (qt_block(help,old,new,sp))
+#define QT_BLOCKI(help,old,new,sp) (qt_block(help,old,new,sp))
+#define QT_ABORT(help,old,new,sp) (qt_abort(help,old,new,sp))
+
+#endif /* ndef QT_GENERIC1_H */
index ff951a0d315740d2b8df406832bb3430d4859883..39ca04d3d135889a32938782fc685abca7970f63 100644 (file)
@@ -19,7 +19,7 @@
 typedef unsigned long qt_word_t;
 
 
-/* Stack layout on the Alpha:
+/* Stack layout on the T3E:
 
    Integer:
 
@@ -49,9 +49,6 @@ typedef unsigned long qt_word_t;
    | f4
    | f3
    | f2
-   | r26
-   +---
-   | padding
    | r29
    | r15
    | r14
@@ -63,29 +60,6 @@ typedef unsigned long qt_word_t;
    | r26       on startup === qt_start         <--- qt.sp
    +---
 
-   Conventions for varargs startup:
-
-   |  :
-   | arg6
-   | iarg5
-   |  :
-   | iarg0
-   | farg5
-   |  :
-   | farg0
-   +---
-   | padding
-   | r29
-   | r15
-   | r14
-   | r13
-   | r12       on startup === `startup'
-   | r11       on startup === `vuserf'
-   | r10       on startup === `cleanup'
-   | r9                on startup === `qt'
-   | r26       on startup === qt_vstart        <--- qt.sp
-   +---
-
    Note: this is a pretty cheap/sleazy way to get things going,
    but ``there must be a better way.''  For instance, some varargs
    parameters could be loaded in to integer registers, or the return
@@ -94,21 +68,15 @@ typedef unsigned long qt_word_t;
 
 /* Stack must be 16-byte aligned. */
 #define QT_STKALIGN    (16)
-
-/* How much space is allocated to hold all the crud for
-   initialization: 7 registers times 8 bytes/register. */
-
-#define QT_STKBASE     (10 * 8)
+#define QT_STKBASE     256
 #define QT_VSTKBASE    QT_STKBASE
 
-
 /* Offsets of various registers. */
-#define QT_R26 0
-#define QT_R9  1
-#define QT_R10 2
-#define QT_R11 3
-#define QT_R12 4
-
+#define QT_R26 11
+#define QT_R9  12
+#define QT_R10 13
+#define QT_R11 14
+#define QT_R12 15
 
 /* When a never-before-run thread is restored, the return pc points
    to a fragment of code that starts the thread running.  For
index b376423bb4ddfee157c5d07506da48e5c09a0355..e291e1cd683eeab8a5a4fd013e7f52cfd7a8f25c 100644 (file)
 ; /* t3e.s -- assembly support. */
 
        .ident qt$s
-
-;      /*
-;      ** $16: ptr to function to call once curr is suspended
-;      **      and control is on r19's stack.
-;      ** $17: 1'th arg to (*$16)(...).
-;      ** $18: 2'th arg to (*$16)(...).
-;      ** $19: sp of thread to resume.
-;      **
-;      ** The helper routine returns a value that is passed on as the
-;      ** return value from the blocking routine.  Since we don't
-;      ** touch r0 between the helper's return and the end of
-;      ** function, we get this behavior for free.
-;      */
-
        .extern qt_error
-       
        .stack 256
-       .psect qt_blocki@code,code,cache
+       .psect qt_block@code,code,cache
          
+qt_block::     
 qt_blocki::
-       subq r30,80, r30
-       stq r26, 0(r30) 
-       stq  r9, 8(r30)
-       stq r10,16(r30)
-       stq r11,24(r30)
-       stq r12,32(r30)
-       stq r13,40(r30)
-       stq r14,48(r30)
-       stq r15,56(r30)
-       stq r29,64(r30)
-       
+       subq r30,160, r30
+       stt  f2, 24(r30)
+       stt  f3, 32(r30)
+       stt  f4, 40(r30)
+       stt  f5, 48(r30)
+       stt  f6, 56(r30)
+       stt  f7, 64(r30)
+       stt  f8, 72(r30)
+       stt  f9, 80(r30)
+       stq r26, 88(r30)        
+       stq  r9, 96(r30)
+       stq r10,104(r30)
+       stq r11,112(r30)
+       stq r12,120(r30)
+       stq r13,128(r30)
+       stq r14,136(r30)
+       stq r15,144(r30)
+       stq r29,152(r30)
 qt_abort::
        addq r16,r31, r27
        addq r30,r31, r16
        addq r19,r31, r30
        jsr r26,(r27),0
-
-       ldq r26, 0(r30)
-       ldq  r9, 8(r30)
-       ldq r10,16(r30)
-       ldq r11,24(r30)
-       ldq r12,32(r30)
-       ldq r13,40(r30)
-       ldq r14,48(r30)
-       ldq r15,56(r30)
-       ldq r29,64(r30)
-
-       addq r30,80, r30
+       ldt  f2, 24(r30)
+       ldt  f3, 32(r30)
+       ldt  f4, 40(r30)
+       ldt  f5, 48(r30)
+       ldt  f6, 56(r30)
+       ldt  f7, 64(r30)
+       ldt  f8, 72(r30)
+       ldt  f9, 80(r30)
+       ldq r26, 88(r30)
+       ldq  r9, 96(r30)
+       ldq r10,104(r30)
+       ldq r11,112(r30)
+       ldq r12,120(r30)
+       ldq r13,128(r30)
+       ldq r14,136(r30)
+       ldq r15,144(r30)
+       ldq r29,152(r30)
+       addq r30,160, r30
        ret r31,(r26),1 
-       .endp
-
 
-;      /*
-;      ** Non-varargs thread startup.
-;      */
-       .stack 256
-       .psect qt_start@code,code,cache
 qt_start::     
        addq r9,r31,  r16
        addq r10,r31, r17
        addq r11,r31, r18
        addq r12,r31, r27
        jsr r26,(r27),0         
-
        bsr r26,qt_error        
 
-
 qt_vstart::    
-
-       addq r9,r31, r16        
-       addq r12,r31, r27       
-       jsr r26,(r27),0         
-
-       ldt f16, 0(r30)
-       ldt f17, 8(r30)
-       ldt f18,16(r30)
-       ldt f19,24(r30)
-       ldt f20,32(r30)
-       ldt f21,40(r30)
-       ldq r16,48(r30) 
-       ldq r17,56(r30)
-       ldq r18,64(r30)
-       ldq r19,72(r30)
-       ldq r20,80(r30)
-       ldq r21,88(r30)
-       addq r30,96,r30
-       addq r11,r31, r27
-       jsr r26,(r27),0         
-
-       addq r9,r31, r16        
-       addq r0,r31, r17        
-       addq r10,r31, r27       
-       jsr r26,(r27),0         
-
        bsr r26,qt_error
-       .endp
 
-
-;      /*
-;      ** Save calle-save floating-point regs f2..f9.
-;      ** Also save return pc from whomever called us.
-;      **
-;      ** Return value from `qt_block' is the same as the return from
-;      ** `qt_blocki'.  We get that for free since we don't touch r0
-;      ** between the return from `qt_blocki' and the return from
-;      ** `qt_block'.
-;      */
-       .stack 256
-       .psect qt_block@code,code,cache
-qt_block::     
-       subq r30,80, r30
-       stq r26, 0(r30) 
-       stt f2, 8(r30)
-       stt f3,16(r30)
-       stt f4,24(r30)
-       stt f5,32(r30)
-       stt f6,40(r30)
-       stt f7,48(r30)
-       stt f8,56(r30)
-       stt f9,64(r30)
-
-       bsr r26,qt_blocki
-                               
-
-       ldq r26, 0(r30)         
-       ldt f2, 8(r30)
-       ldt f3,16(r30)
-       ldt f4,24(r30)
-       ldt f5,32(r30)
-       ldt f6,40(r30)
-       ldt f7,48(r30)
-       ldt f8,56(r30)
-       ldt f9,64(r30)
-
-       addq r30,80, r30        
-       ret r31,(r26),1         
+       
        .endp
        .end qt$s
+
index 411fc24a26525305b540bd95637d0468f7ecb5f3..db0dfba6d342e5820c1ce74221d85a89b20849f1 100644 (file)
@@ -6,7 +6,7 @@ all: qt stp testpgm
 qt:
        ln -s md/setjmp_d.h qtmd.h
        $(CC) -pedantic -Wall -c -o qt.o qt.c
-       $(CC) -c -o qtmds.o md/sjalloca.c
+       $(CC) -DQT_GROW_DOWN -c -o qtmds.o md/setjmp.c
        ar q libqt.a qt.o qtmds.o
 
 stp:
diff --git a/src/QuickThreads/mkfiles/cray-t3e-cc b/src/QuickThreads/mkfiles/cray-t3e-cc
new file mode 100644 (file)
index 0000000..2fa9e3b
--- /dev/null
@@ -0,0 +1,20 @@
+
+CC=cc -D__AXP__ -I.
+
+all: qt stp testpgm
+
+qt:
+       ln -s md/t3e.h qtmd.h
+       $CC -c -o qt.o qt.c
+       cam -o qtmds.o md/t3e.s
+       ar q libqt.a qt.o qtmds.o
+
+stp:
+       $CC -c stp.c
+       ar q libstp.a stp.o
+
+testpgm:
+       $CC -c meas.c
+       cam -o qtmdb.o md/t3e_b.s
+       $CC -o run meas.o qtmdb.o libstp.a libqt.a
+
diff --git a/src/QuickThreads/mkfiles/generic b/src/QuickThreads/mkfiles/generic
new file mode 100644 (file)
index 0000000..db0dfba
--- /dev/null
@@ -0,0 +1,19 @@
+
+CC=gcc -I.
+
+all: qt stp testpgm
+
+qt:
+       ln -s md/setjmp_d.h qtmd.h
+       $(CC) -pedantic -Wall -c -o qt.o qt.c
+       $(CC) -DQT_GROW_DOWN -c -o qtmds.o md/setjmp.c
+       ar q libqt.a qt.o qtmds.o
+
+stp:
+       $(CC) -c stp.c
+       ar q libstp.a stp.o
+
+testpgm:
+       $(CC) -c meas.c
+       $(CC) -c -o qtmdb.o md/setjmp_b.c
+       $(CC) -o run meas.o qtmdb.o libstp.a libqt.a
diff --git a/src/QuickThreads/mkfiles/t3e b/src/QuickThreads/mkfiles/t3e
deleted file mode 100755 (executable)
index 305112c..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh -x
-
-CC="cc -D__AXP__ -I."
-
-ln -s md/t3e.h qtmd.h
-$CC -c -o qt.o qt.c
-cam -o qtmds.o md/t3e.s
-ar q libqt.a qt.o qtmds.o
-
-$CC -c stp.c
-ar q libstp.a stp.o
-
-#$CC -c meas.c
-#cam -o qtmdb.o md/t3e_b.s
-#$CC -o run meas.o qtmdb.o libstp.a libqt.a
diff --git a/src/QuickThreads/mkfiles/vax-cc b/src/QuickThreads/mkfiles/vax-cc
new file mode 100644 (file)
index 0000000..69a4a94
--- /dev/null
@@ -0,0 +1,24 @@
+#
+# Note: I have absolutely no idea how to write vax scripting language.
+# so, i wrote a script that's generally the right idea.  Somebody familiar
+# with vaxen will have to make this script actually work.
+#
+
+CC=cc -I.
+
+all: qt stp testpgm
+
+qt:
+       ln -s md/vax.h qtmd.h
+       $(CC) -pedantic -Wall -c -o qt.o qt.c
+       as -o qtmds.o md/vax.s
+       ar q libqt.a qt.o qtmds.o
+
+stp:
+       $(CC) -c stp.c
+       ar q libstp.a stp.o
+
+testpgm:
+       $(CC) -c meas.c
+       as -o qtmdb.o md/vax_b.s
+       $(CC) -o run meas.o qtmdb.o libstp.a libqt.a
index d945cb4ca5961f0c2b3e0b9601d158f00e72023f..dbe22c4f92f699d3df588d676f27d4e293aaf2cf 100644 (file)
@@ -45,4 +45,4 @@ set CMK_NM='nm'
 set CMK_NM_FILTER="grep ' T ' | awk '{print "'$'"3;}'"
 set CMK_CPP_SUFFIX="i"
 set CMK_XLATPP='charmxlat++ '
-set CMK_QT='t3e'
+set CMK_QT='cray-t3e-cc'