[OpenAFS-devel] ia64 port ready for testing...

chas williams chas@cmf.nrl.navy.mil
Mon, 6 Aug 2001 13:09:23 -0400


ftp://ftp.cmf.nrl.navy.mil/pub/chas/openafs/ia64_linux24

openafs.tar.gz	complete image of the current work (includes binaries)

1.1.1-diffs	diffs relative to 1.1.1 that dont include the string.h/strings.h
		fixes i needed to make -- also included in this message

no special instructions this time other than you need a rather recent
glibc (turbolinux beta5 or redhat 7.1) since the afs userland utilities
use ucontext() instead of setjmp()/longjmp().  this is probably the weakest
part of the port since lwp is somewhat difficult to test rigorously.

you can insmod the afs module now (and rmmod if you like)  why so difficult?
function pointers are really pointers to a function descriptor that contains
the function pointer and global pointer.  the syscall table (being written
in assembler) only contains function pointers.  it doesnt setup the gp.
modules and kernels do not share the same gp.  so if you want the syscall
to go to a module, you need to setup the gp and then call your module's
routine.  be sure to restore the gp after returning from your routine :)
i also converted to the 'new style' module_init() -- only used on kernel
versions 2.4.0 and up.  this does the right thing if you happen to be
linked directly with the kernel.

klog has been fixed (afs's crypt() function is sensitive to sizeof(long) --
des/crypt.c should probably use 'afs_int32', not 'long' or 'int')

in case it matters, my platform is a b3-stepping running beta5 of turbolinux.


Index: configure.in
===================================================================
RCS file: /afs/cmf/project/cvsroot/openafs/configure.in,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -u -r1.1.1.1 -r1.2
--- configure.in	2001/07/28 17:05:27	1.1.1.1
+++ configure.in	2001/08/02 23:25:11	1.2
@@ -210,6 +210,9 @@
 		mips-sgi-irix6.5)
 			AFS_SYSNAME="sgi_65"
 			;;
+		ia64-*-linux*)
+			AFS_SYSNAME="ia64_linuxXX"
+			;;
 		powerpc-*-linux*)
 			AFS_SYSNAME="ppc_linuxXX"
 			;;
Index: src/afs/afs_call.c
===================================================================
RCS file: /afs/cmf/project/cvsroot/openafs/src/afs/afs_call.c,v
retrieving revision 1.1.1.5
retrieving revision 1.3
diff -u -u -r1.1.1.5 -r1.3
--- afs_call.c	2001/07/28 17:05:33	1.1.1.5
+++ afs_call.c	2001/08/02 23:25:11	1.3
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /afs/cmf/project/cvsroot/openafs/src/afs/afs_call.c,v 1.1.1.5 2001/07/28 17:05:33 chas Exp $");
+RCSID("$Header: /afs/cmf/project/cvsroot/openafs/src/afs/afs_call.c,v 1.3 2001/08/02 23:25:11 chas Exp $");
 
 #include "../afs/sysincludes.h"	/* Standard vendor system headers */
 #include "../afs/afsincludes.h"	/* Afs-based standard headers */
@@ -842,7 +842,7 @@
 	}
 #endif /* AFS_SUN57_64BIT_ENV */
 
-#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV)
+#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
 	struct iparam32 dst32;
 
 #ifdef AFS_SPARC64_LINUX24_ENV
Index: src/afs/afs_pioctl.c
===================================================================
RCS file: /afs/cmf/project/cvsroot/openafs/src/afs/afs_pioctl.c,v
retrieving revision 1.1.1.5
retrieving revision 1.2
diff -u -u -r1.1.1.5 -r1.2
--- afs_pioctl.c	2001/07/28 17:05:42	1.1.1.5
+++ afs_pioctl.c	2001/07/28 20:43:33	1.2
@@ -10,7 +10,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /afs/cmf/project/cvsroot/openafs/src/afs/afs_pioctl.c,v 1.1.1.5 2001/07/28 17:05:42 chas Exp $");
+RCSID("$Header: /afs/cmf/project/cvsroot/openafs/src/afs/afs_pioctl.c,v 1.2 2001/07/28 20:43:33 chas Exp $");
 
 #include "../afs/sysincludes.h"	/* Standard vendor system headers */
 #include "../afs/afsincludes.h"	/* Afs-based standard headers */
@@ -200,7 +200,7 @@
 	}
 #endif /* defined(AFS_SGI_ENV) && (_MIPS_SZLONG==64) */
 
-#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV)
+#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
 	struct afs_ioctl32 dst32;
 
 #ifdef AFS_SPARC64_LINUX24_ENV
@@ -737,6 +737,7 @@
 #ifdef AFS_LINUX22_ENV
     cred_t *credp = crref(); /* don't free until done! */
     struct dentry *dp;
+
 #endif
     AFS_STATCNT(afs_syscall_pioctl);
     if (follow) follow = 1;	/* compat. with old venus */
@@ -1075,7 +1076,7 @@
     return afs_CheckCode(code, &treq, 41);
   }
   
-  static PGetFID(avc, afun, areq, ain, aout, ainSize, aoutSize)
+static PGetFID(avc, afun, areq, ain, aout, ainSize, aoutSize)
     struct vcache *avc;
   int afun;
   struct vrequest *areq;
Index: src/afs/LINUX/osi_alloc.c
===================================================================
RCS file: /afs/cmf/project/cvsroot/openafs/src/afs/LINUX/osi_alloc.c,v
retrieving revision 1.1.1.4
retrieving revision 1.6
diff -u -u -r1.1.1.4 -r1.6
--- osi_alloc.c	2001/07/28 17:06:12	1.1.1.4
+++ osi_alloc.c	2001/07/28 20:43:37	1.6
@@ -14,11 +14,12 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /afs/cmf/project/cvsroot/openafs/src/afs/LINUX/osi_alloc.c,v 1.1.1.4 2001/07/28 17:06:12 chas Exp $");
+RCSID("$Header: /afs/cmf/project/cvsroot/openafs/src/afs/LINUX/osi_alloc.c,v 1.6 2001/07/28 20:43:37 chas Exp $");
 
 #include "../afs/sysincludes.h"
 #include "../afs/afsincludes.h"
 #include "../h/mm.h"
+#include "../h/slab.h"
 
 #include "../afs/afs_atomlist.h"
 #include "../afs/afs_lhash.h"
@@ -86,7 +87,7 @@
 
     /*  if we can use kmalloc use it to allocate the required memory. */
     if (asize <  MAX_KMALLOC_SIZE) {
-        new = (void *)(long)kmalloc(asize, GFP_KERNEL);
+        new = (void *)(unsigned long)kmalloc(asize, GFP_KERNEL);
         if (new) /* piggy back alloc type */
             (unsigned long)new |= KM_TYPE;
     }
Index: src/afs/LINUX/osi_groups.c
===================================================================
RCS file: /afs/cmf/project/cvsroot/openafs/src/afs/LINUX/osi_groups.c,v
retrieving revision 1.1.1.5
retrieving revision 1.2
diff -u -u -r1.1.1.5 -r1.2
--- osi_groups.c	2001/07/28 17:06:13	1.1.1.5
+++ osi_groups.c	2001/08/06 12:24:47	1.2
@@ -16,7 +16,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /afs/cmf/project/cvsroot/openafs/src/afs/LINUX/osi_groups.c,v 1.1.1.5 2001/07/28 17:06:13 chas Exp $");
+RCSID("$Header: /afs/cmf/project/cvsroot/openafs/src/afs/LINUX/osi_groups.c,v 1.2 2001/08/06 12:24:47 chas Exp $");
 
 #include "../afs/sysincludes.h"
 #include "../afs/afsincludes.h"
@@ -100,8 +100,8 @@
 
 
 /* Intercept the standard system call. */
-extern int (*sys_setgroupsp)(int gidsetsize, gid_t *grouplist);
-asmlinkage int afs_xsetgroups(int gidsetsize, gid_t *grouplist)
+extern long (*sys_setgroupsp)(int gidsetsize, gid_t *grouplist);
+asmlinkage long afs_xsetgroups(int gidsetsize, gid_t *grouplist)
 {
     int code;
     cred_t *cr = crref();
Index: src/afs/LINUX/osi_machdep.h
===================================================================
RCS file: /afs/cmf/project/cvsroot/openafs/src/afs/LINUX/osi_machdep.h,v
retrieving revision 1.1.1.3
retrieving revision 1.2
diff -u -u -r1.1.1.3 -r1.2
--- osi_machdep.h	2001/01/23 21:24:06	1.1.1.3
+++ osi_machdep.h	2001/07/28 20:43:39	1.2
@@ -31,7 +31,7 @@
 #include "../h/sched.h"
 #define osi_Time() (xtime.tv_sec)
 #if  (CPU == sparc64)
-#define osi_GetTime(V) do { (*##V##).tv_sec = xtime.tv_sec; (*##V##).tv_usec = xtime.tv_usec; } while (0)
+#define osi_GetTime(V) do { (*(V)).tv_sec = xtime.tv_sec; (*(V)).tv_usec = xtime.tv_usec; } while (0)
 #else
 #define osi_GetTime(V) (*(V)=xtime)
 #endif
Index: src/afs/LINUX/osi_module.c
===================================================================
RCS file: /afs/cmf/project/cvsroot/openafs/src/afs/LINUX/osi_module.c,v
retrieving revision 1.1.1.5
retrieving revision 1.8
diff -u -u -r1.1.1.5 -r1.8
--- osi_module.c	2001/07/28 17:06:14	1.1.1.5
+++ osi_module.c	2001/08/06 12:24:49	1.8
@@ -14,7 +14,7 @@
 #include <afsconfig.h>
 #include "../afs/param.h"
 
-RCSID("$Header: /afs/cmf/project/cvsroot/openafs/src/afs/LINUX/osi_module.c,v 1.1.1.5 2001/07/28 17:06:14 chas Exp $");
+RCSID("$Header: /afs/cmf/project/cvsroot/openafs/src/afs/LINUX/osi_module.c,v 1.8 2001/08/06 12:24:49 chas Exp $");
 
 #include "../afs/sysincludes.h"
 #include "../afs/afsincludes.h"
@@ -22,6 +22,11 @@
 #include "../h/mm.h"
 
 #include <linux/module.h>
+#include <linux/slab.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+#include <linux/init.h>
+#endif
+
 
 
 #ifdef AFS_SPARC64_LINUX24_ENV
@@ -33,7 +38,7 @@
 asmlinkage int (*sys_socketcallp)(int call, long *args);
 #endif /* no socketcall on alpha */
 asmlinkage int (*sys_killp)(int pid, int signal);
-asmlinkage int (*sys_setgroupsp)(int gidsetsize, gid_t *grouplist);
+asmlinkage long (*sys_setgroupsp)(int gidsetsize, gid_t *grouplist);
 
 #ifdef AFS_SPARC64_LINUX20_ENV
 extern unsigned int sys_call_table[];  /* changed to uint because SPARC64 has syscaltable of 32bit items */
@@ -83,6 +88,63 @@
 }
 #endif
 
+#ifdef AFS_IA64_LINUX20_ENV
+unsigned char ia64_syscall_stub[] =
+{
+  0x00, 0x50, 0x45, 0x16, 0x80, 0x05,   //  [MII]  alloc r42=ar.pfs,8,3,6,0
+  0x90, 0x02, 0x00, 0x62, 0x00, 0x60,   //         mov r41=b0
+  0x05, 0x00, 0x01, 0x84,               //         mov r43=r32
+  0x00, 0x60, 0x01, 0x42, 0x00, 0x21,   //  [MII]  mov r44=r33
+  0xd0, 0x02, 0x88, 0x00, 0x42, 0xc0,   //         mov r45=r34
+  0x05, 0x18, 0x01, 0x84,               //         mov r46=r35
+  0x0d, 0x78, 0x01, 0x48, 0x00, 0x21,   //  [MFI]  mov r47=r36
+  0x00, 0x00, 0x00, 0x02, 0x00, 0x00,   //         nop.f 0x0
+  0x06, 0x08, 0x00, 0x84,               //         mov r48=gp;;
+  0x05, 0x00, 0x00, 0x00, 0x01, 0x00,   //  [MLX]  nop.m 0x0
+  0x00, 0x00, 0x00, 0x00, 0x00, 0xe0,   //         movl r15=0x0;;
+  0x01, 0x00, 0x00, 0x60,               //
+  0x0a, 0x80, 0x20, 0x1e, 0x18, 0x14,   //  [MMI]  ld8 r16=[r15],8;;
+  0x10, 0x00, 0x3c, 0x30, 0x20, 0xc0,   //         ld8 gp=[r15]
+  0x00, 0x09, 0x00, 0x07,               //         mov b6=r16
+  0x1d, 0x00, 0x00, 0x00, 0x01, 0x00,   //  [MFB]  nop.m 0x0
+  0x00, 0x00, 0x00, 0x02, 0x00, 0x00,   //         nop.f 0x0
+  0x68, 0x00, 0x00, 0x10,               //         br.call.sptk.many b0=b6;;
+  0x00, 0x00, 0x00, 0x00, 0x01, 0x00,   //  [MII]  nop.m 0x0
+  0x00, 0x50, 0x01, 0x55, 0x00, 0x00,   //         mov.i ar.pfs=r42
+  0x90, 0x0a, 0x00, 0x07,               //         mov b0=r41
+  0x1d, 0x08, 0x00, 0x60, 0x00, 0x21,   //  [MFB]  mov gp=r48
+  0x00, 0x00, 0x00, 0x02, 0x00, 0x80,   //         nop.f 0x0
+  0x08, 0x00, 0x84, 0x00                //         br.ret.sptk.many b0;;
+};
+
+void ia64_imm64_fixup(unsigned long v, void *code)
+{
+        unsigned long *bundle = (unsigned long *) code;
+
+        unsigned long insn;
+        unsigned long slot1;
+
+        insn = ((v & 0x8000000000000000) >> 27) | ((v & 0x0000000000200000)) |
+           ((v & 0x00000000001f0000) <<  6) | ((v & 0x000000000000ff80) << 20) |
+           ((v & 0x000000000000007f) << 13);
+
+        slot1 = (v & 0x7fffffffffc00000) >> 22;
+
+        *bundle |= slot1 << 46;
+        *(bundle+1) |= insn << 23;
+        *(bundle+1) |= slot1 >> 18;
+}
+
+unsigned char *afs_syscall_stub, *afs_xsetgroups_stub;
+
+struct fptr
+{
+	unsigned long ip;
+	unsigned long gp;
+};
+
+#endif /* AFS_IA64_LINUX20_ENV */
+
 #ifdef AFS_LINUX24_ENV
 asmlinkage int (*sys_setgroups32p)(int gidsetsize, __kernel_gid32_t *grouplist);
 #endif 
@@ -95,10 +157,18 @@
 #define SYSCALL2POINTER (void *)
 #endif
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+int __init afs_init(void)
+#else
 int init_module(void)
+#endif
 {
+#if defined(AFS_IA64_LINUX20_ENV)
+    unsigned long kernel_gp;
+    static struct fptr sys_kill, sys_settimeofday, sys_setgroups;
+#endif
     extern int afs_syscall();
-    extern int afs_xsetgroups();
+    extern long afs_xsetgroups();
 #if defined(__NR_setgroups32)
     extern int afs_xsetgroups32();
 #endif
@@ -109,6 +179,8 @@
 #endif
 #endif
 
+
+
     /* obtain PAGE_OFFSET value */
     afs_linux_page_offset = get_page_offset();
 
@@ -121,64 +193,111 @@
 #endif
 
     /* Initialize pointers to kernel syscalls. */
+#if defined(AFS_IA64_LINUX20_ENV)
+    kernel_gp = ((struct fptr *)printk)->gp;
+
+    sys_settimeofdayp = (void *) &sys_settimeofday;
+    sys_killp = (void *) &sys_kill;
+
+    ((struct fptr *)sys_settimeofdayp)->ip =
+		SYSCALL2POINTER sys_call_table[__NR_settimeofday - 1024];
+    ((struct fptr *)sys_settimeofdayp)->gp = kernel_gp;
+    
+    ((struct fptr *)sys_killp)->ip =
+		SYSCALL2POINTER sys_call_table[__NR_kill - 1024];
+    ((struct fptr *)sys_killp)->gp = kernel_gp;
+#else /* !AFS_IA64_LINUX20_ENV */
     sys_settimeofdayp = SYSCALL2POINTER sys_call_table[__NR_settimeofday];
-#if !defined(AFS_ALPHA_LINUX20_ENV)
+#ifdef __NR_socketcall
     sys_socketcallp = SYSCALL2POINTER sys_call_table[__NR_socketcall];
 #endif /* no socketcall on alpha */
     sys_killp = SYSCALL2POINTER sys_call_table[__NR_kill];
+#endif /* AFS_IA64_LINUX20_ENV */
 
     /* setup AFS entry point. */
-    if (SYSCALL2POINTER sys_call_table[__NR_afs_syscall] == afs_syscall) {
+    if (SYSCALL2POINTER sys_call_table[__NR_afs_syscall - 1024] == afs_syscall) {
 	printf("AFS syscall entry point already in use!\n");
 	return -EBUSY;
     }
 
 
+#if defined(AFS_IA64_LINUX20_ENV)
+    afs_ni_syscall = sys_call_table[__NR_afs_syscall - 1024];
+
+    afs_syscall_stub = (void *) kmalloc(sizeof(ia64_syscall_stub), GFP_KERNEL);
+    memcpy(afs_syscall_stub, ia64_syscall_stub, sizeof(ia64_syscall_stub));
+    ia64_imm64_fixup((unsigned long)afs_syscall, afs_syscall_stub+0x30);
+    sys_call_table[__NR_afs_syscall - 1024] = POINTER2SYSCALL afs_syscall_stub;
+#else /* AFS_IA64_LINUX20_ENV */
     afs_ni_syscall = sys_call_table[__NR_afs_syscall];
     sys_call_table[__NR_afs_syscall] = POINTER2SYSCALL afs_syscall;
-#ifdef AFS_SPARC64_LINUX20_ENV
+# ifdef AFS_SPARC64_LINUX20_ENV
     afs_ni_syscall32 = sys_call_table32[__NR_afs_syscall];
     sys_call_table32[__NR_afs_syscall] = POINTER2SYSCALL afs_syscall32;
-#endif
+# endif
+#endif /* AFS_IA64_LINUX20_ENV */
 
     osi_Init();
     register_filesystem(&afs_file_system);
 
     /* Intercept setgroups calls */
+#if defined(AFS_IA64_LINUX20_ENV)
+    sys_setgroupsp = (void *) &sys_setgroups;
+
+    afs_xsetgroups_stub = (void *) kmalloc(sizeof(ia64_syscall_stub), GFP_KERNEL);
+    memcpy(afs_xsetgroups_stub, ia64_syscall_stub, sizeof(ia64_syscall_stub));
+    ia64_imm64_fixup((unsigned long)afs_xsetgroups, afs_xsetgroups_stub+0x30);
+
+    ((struct fptr *)sys_setgroupsp)->ip =
+		SYSCALL2POINTER sys_call_table[__NR_setgroups - 1024];
+    ((struct fptr *)sys_setgroupsp)->gp = kernel_gp;
+
+    sys_call_table[__NR_setgroups - 1024] = POINTER2SYSCALL afs_xsetgroups_stub;
+#else /* AFS_IA64_LINUX20_ENV */
     sys_setgroupsp = SYSCALL2POINTER sys_call_table[__NR_setgroups];
     sys_call_table[__NR_setgroups] = POINTER2SYSCALL afs_xsetgroups;
-#ifdef AFS_SPARC64_LINUX20_ENV
+# ifdef AFS_SPARC64_LINUX20_ENV
     sys32_setgroupsp = SYSCALL2POINTER sys_call_table32[__NR_setgroups];
     sys_call_table32[__NR_setgroups] = POINTER2SYSCALL afs32_xsetgroups;
-#endif
-#if defined(__NR_setgroups32)
+# endif
+# if defined(__NR_setgroups32)
     sys_setgroups32p = SYSCALL2POINTER sys_call_table[__NR_setgroups32];
     sys_call_table[__NR_setgroups32] = POINTER2SYSCALL afs_xsetgroups32;
-#ifdef AFS_SPARC64_LINUX20_ENV
+# ifdef AFS_SPARC64_LINUX20_ENV
     sys32_setgroups32p = SYSCALL2POINTER sys_call_table32[__NR_setgroups32];
     sys_call_table32[__NR_setgroups32] = POINTER2SYSCALL afs32_xsetgroups32;
-#endif
-#endif
+# endif
+# endif
+#endif /* AFS_IA64_LINUX20_ENV */
 
     return 0;
 }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+void __exit afs_cleanup(void)
+#else
 void cleanup_module(void)
+#endif
 {
     struct task_struct *t;
 
+#if defined(AFS_IA64_LINUX20_ENV)
+    sys_call_table[__NR_setgroups - 1024] = POINTER2SYSCALL ((struct fptr *) sys_setgroupsp)->ip;
+    sys_call_table[__NR_afs_syscall - 1024] = afs_ni_syscall;
+#else /* AFS_IA64_LINUX20_ENV */
     sys_call_table[__NR_setgroups] = POINTER2SYSCALL sys_setgroupsp;
     sys_call_table[__NR_afs_syscall] = afs_ni_syscall;
-#ifdef AFS_SPARC64_LINUX20_ENV
+# ifdef AFS_SPARC64_LINUX20_ENV
     sys_call_table32[__NR_setgroups] = POINTER2SYSCALL sys32_setgroupsp;
     sys_call_table32[__NR_afs_syscall] = afs_ni_syscall32;
-#endif
-#if defined(__NR_setgroups32)
+# endif
+# if defined(__NR_setgroups32)
     sys_call_table[__NR_setgroups32] = POINTER2SYSCALL sys_setgroups32p;
-#ifdef AFS_SPARC64_LINUX20_ENV
+# ifdef AFS_SPARC64_LINUX20_ENV
     sys_call_table32[__NR_setgroups32] = POINTER2SYSCALL sys32_setgroups32p;
-#endif
-#endif
+# endif
+# endif
+#endif /* AFS_IA64_LINUX20_ENV */
     unregister_filesystem(&afs_file_system);
 
     osi_linux_free_inode_pages(); /* Invalidate all pages using AFS inodes. */
@@ -187,9 +306,15 @@
     return;
 }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
+module_init(afs_init);
+module_exit(afs_cleanup);
+#endif
+
+
 static long get_page_offset(void)
 {
-#if defined(AFS_PPC_LINUX22_ENV) || defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) || defined(AFS_ALPHA_LINUX20_ENV) || defined(AFS_S390_LINUX22_ENV)
+#if defined(AFS_PPC_LINUX22_ENV) || defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) || defined(AFS_ALPHA_LINUX20_ENV) || defined(AFS_S390_LINUX22_ENV) || defined(AFS_IA64_LINUX20_ENV)
     return PAGE_OFFSET;
 #else
     struct task_struct *p;
Index: src/config/Makefile.ia64_linux24.in
===================================================================
RCS file: Makefile.ia64_linux24.in
diff -N Makefile.ia64_linux24.in
--- /dev/null	Mon Aug  6 12:09:07 2001
+++ /var/tmp/iaaqYa4Wp	Mon Aug  6 12:21:32 2001
@@ -0,0 +1,50 @@
+# Copyright 1998 Transarc Corporation 
+#
+# Keep macros within each section in sorted order for clean diff displays.
+#
+# AFS_OSTYPE used to indicate suffixes and os specific subdirectories.
+AFS_OSTYPE = LINUX
+
+# Base directory for linux kernel source. Actually a prefix which is complete
+# when LINUX_VERS is appended to it.
+LINUX_SRCDIR = /usr/src/linux-
+# Default list of Linux kernels to build. Build will run only if all
+# can be built. To build a different set, specify LINUX_VERS to make.
+LINUX_VERS = 2.4.5
+
+#
+# compilation and link editor flags
+DBG=-g
+OPTMZ=-g -O2
+PAM_CFLAGS = -O2 -Dlinux -DLINUX_PAM -fPIC
+# Put -O2 here to _ensure_ all Makefiles pick it up.
+XCFLAGS= -O2
+MT_CFLAGS=-DAFS_PTHREAD_ENV -pthread -D_REENTRANT ${XCFLAGS}
+XLDFLAGS=
+SHARE_LDFLAGS = -shared -Xlinker -x
+SHLIB_SUFFIX=so
+SHLIB_CFLAGS=
+#
+# libraries
+MTLIBS=-lpthread
+TXLIBS= /usr/lib/libncurses.so
+XLIBS= @LIB_AFSDB@
+#
+# programs
+AR=ar
+AS=as
+CP=cp
+LD=ld
+MT_CC=cc
+MV=mv
+RANLIB=ranlib
+RM=rm
+WASHTOOL=${DESTDIR}bin/washtool
+INSTALL=${DESTDIR}bin/install
+#
+# Other OS specific requirements
+#
+YACC = bison -y
+LEX = flex -l
+# Used in des library.
+CRYPT_OBJ = crypt.o
Index: src/config/afs_sysnames.h
===================================================================
RCS file: /afs/cmf/project/cvsroot/openafs/src/config/afs_sysnames.h,v
retrieving revision 1.1.1.5
retrieving revision 1.6
diff -u -u -r1.1.1.5 -r1.6
--- afs_sysnames.h	2001/07/28 17:44:43	1.1.1.5
+++ afs_sysnames.h	2001/07/28 21:12:30	1.6
@@ -135,6 +135,10 @@
 
 #define SYS_NAME_ID_i386_fbsd_42        2100
 
+#define SYS_NAME_ID_ia64_linux2		2200
+#define SYS_NAME_ID_ia64_linux22	2201
+#define SYS_NAME_ID_ia64_linux24	2202
+
 /*
  * Placeholder to keep system-wide standard flags since this file is included by all 
  * files (i.e in afs/param.h)
Index: src/des/andrew-conf.h
===================================================================
RCS file: /afs/cmf/project/cvsroot/openafs/src/des/andrew-conf.h,v
retrieving revision 1.1.1.5
retrieving revision 1.5
diff -u -u -r1.1.1.5 -r1.5
--- andrew-conf.h	2001/07/28 17:45:03	1.1.1.5
+++ andrew-conf.h	2001/07/28 21:21:34	1.5
@@ -55,7 +55,11 @@
 #ifdef AFS_ALPHA_LINUX20_ENV
 #include "conf-alpha-linux.h"
 #else
+#ifdef AFS_IA64_LINUX20_ENV
+#include "conf-ia64-linux.h"
+#else
 #include "conf-i386-linux.h"
+#endif /* AFS_IA64_LINUX20_ENV */
 #endif /* AFS_ALPHA_LINUX20_ENV */
 #endif /* AFS_S390_LINUX20_ENV */
 #endif /* AFS_SPARC64_LINUX20_ENV */
Index: src/des/conf-ia64-linux.h
===================================================================
RCS file: conf-ia64-linux.h
diff -N conf-ia64-linux.h
--- /dev/null	Mon Aug  6 12:09:07 2001
+++ /var/tmp/naavYa4Wp	Mon Aug  6 12:21:36 2001
@@ -0,0 +1,13 @@
+/*
+ * Copyright 1988 by the Massachusetts Institute of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <mit-copyright.h>.
+ *
+ */
+
+#include <mit-cpyright.h>
+
+#define BITS32
+#define BIG
+#define LSBFIRST
Index: src/des/crypt.c
===================================================================
RCS file: /afs/cmf/project/cvsroot/openafs/src/des/crypt.c,v
retrieving revision 1.1.1.2
diff -u -u -r1.1.1.2 crypt.c
--- crypt.c	2001/07/28 17:45:07	1.1.1.2
+++ crypt.c	2001/08/06 16:19:59
@@ -37,18 +37,18 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /afs/cmf/project/cvsroot/openafs/src/des/crypt.c,v 1.1.1.2 2001/07/28 17:45:07 chas Exp $");
+RCSID("$Header: /afs/cmf/project/cvsroot/openafs/src/des/crypt.c,v 1.2 2001/07/29 23:37:58 chas Exp $");
 
 #ifdef AFS_NT40_ENV
 #include <windows.h>
 #endif
 #include <stdlib.h>
-#if defined(HAVE_STRINGS_H)
-#include <strings.h>
-#endif
-#if defined(HAVE_STRING_H)
+#ifdef HAVE_STRING_H
 #include <string.h>
 #endif
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
 
 /*
  * UNIX password, and DES, encryption.
@@ -248,8 +248,13 @@
 	struct {
 #if defined(LONG_IS_32_BITS)
 		/* long is often faster than a 32-bit bit field */
+#if defined(AFS_IA64_LINUX20_ENV)
+		int	i0;
+		int	i1;
+#else
 		long	i0;
 		long	i1;
+#endif
 #else
 		long	i0: 32;
 		long	i1: 32;
@@ -499,6 +504,7 @@
 	long salt;
 	int num_iter, salt_size;
 	C_block keyblock, rsltblock;
+
 
 	for (i = 0; i < 8; i++) {
 		if ((t = 2*(unsigned char)(*key)) != 0)
Index: src/dir/buffer.c
===================================================================
RCS file: /afs/cmf/project/cvsroot/openafs/src/dir/buffer.c,v
retrieving revision 1.1.1.3
retrieving revision 1.2
diff -u -u -r1.1.1.3 -r1.2
--- buffer.c	2001/07/28 17:45:19	1.1.1.3
+++ buffer.c	2001/08/02 23:25:14	1.2
@@ -10,8 +10,9 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /afs/cmf/project/cvsroot/openafs/src/dir/buffer.c,v 1.1.1.3 2001/07/28 17:45:19 chas Exp $");
+RCSID("$Header: /afs/cmf/project/cvsroot/openafs/src/dir/buffer.c,v 1.2 2001/08/02 23:25:14 chas Exp $");
 
+#include <stdlib.h>
 #include <lock.h>
 
 #include "dir.h"
Index: src/libafs/MakefileProto.LINUX.in
===================================================================
RCS file: /afs/cmf/project/cvsroot/openafs/src/libafs/MakefileProto.LINUX.in,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -u -u -r1.1.1.1 -r1.3
--- MakefileProto.LINUX.in	2001/07/28 17:46:38	1.1.1.1
+++ MakefileProto.LINUX.in	2001/08/02 23:25:16	1.3
@@ -64,6 +64,10 @@
 	-fno-strict-aliasing -fsigned-char -msoft-float -pipe \
 	-fno-builtin -ffixed-r2
 DEFINES = -D__KERNEL__  -D__powerpc__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF}
+<ia64_linux24>
+CCFLAGS =   -O2 -fomit-frame-pointer -fno-strict-aliasing -pipe \
+	-ffixed-r13 -mfixed-range=f10-f15,f32-f127 -falign-functions=32 -mb-step
+DEFINES = -D__KERNEL__ -DKERNEL -D_KERNEL ${SMP_DEF} -DMODULE
 <all>
 INCLUDES = -I. -I../ -I${TOP_SRCDIR}/config
 
@@ -121,6 +125,8 @@
 	ln -s ${LINUX_KERNEL_PATH}/include/asm-sparc asm
 <sparc64_linux22 sparc64_linux24>
 	ln -s ${LINUX_KERNEL_PATH}/include/asm-sparc64 asm
+<ia64_linux24>
+	ln -s ${LINUX_KERNEL_PATH}/include/asm-ia64 asm
 <all>
 	for m in ${MPS} ; do \
 		KDIR=${KOBJ}-${LINUX_VERS}${LINUX_MODULE_NAME}-$$m ; \
Index: src/lwp/lwp.h
===================================================================
RCS file: /afs/cmf/project/cvsroot/openafs/src/lwp/lwp.h,v
retrieving revision 1.1.1.4
retrieving revision 1.4
diff -u -u -r1.1.1.4 -r1.4
--- lwp.h	2001/07/28 17:46:53	1.1.1.4
+++ lwp.h	2001/08/06 16:03:15	1.4
@@ -20,7 +20,11 @@
 
 #if !defined(KERNEL) && !defined(_KMEMUSER) && !defined(AFS_PTHREAD_ENV)
 #include <afs/param.h>
+#ifdef HAVE_UCONTEXT_H
+#include <ucontext.h>
+#else
 #include <setjmp.h>
+#endif
 
 #define LWP_SUCCESS	0
 #define LWP_EBADPID	-1
@@ -191,14 +195,19 @@
 #else
 struct lwp_context {	/* saved context for dispatcher */
     char *topstack;	/* ptr to top of process stack */
-#if defined(sparc) && !defined(__linux__)
-#ifdef	save_allregs
+#ifdef HAVE_UCONTEXT_H
+    ucontext_t ucontext;
+    int state;
+#else /* !HAVE_UCONTEXT_H */
+# if defined(sparc) && !defined(__linux__)
+# ifdef	save_allregs
     int globals[7+1+32+2+32+2];    /* g1-g7, y reg, f0-f31, fsr, fq, c0-c31, csr, cq. */
-#else
+# else
     int globals[8];    /* g1-g7 and y registers. */
-#endif
-#endif
+# endif
+# endif
     jmp_buf setjmp_buffer;
+#endif /* HAVE_UCONTEXT_H */
 };
 
 struct rock
Index: src/lwp/process.c
===================================================================
RCS file: /afs/cmf/project/cvsroot/openafs/src/lwp/process.c,v
retrieving revision 1.1.1.5
retrieving revision 1.7
diff -u -u -r1.1.1.5 -r1.7
--- process.c	2001/07/28 17:46:54	1.1.1.5
+++ process.c	2001/08/06 16:03:15	1.7
@@ -12,7 +12,7 @@
 #include <afsconfig.h>
 #include <afs/param.h>
 
-RCSID("$Header: /afs/cmf/project/cvsroot/openafs/src/lwp/process.c,v 1.1.1.5 2001/07/28 17:46:54 chas Exp $");
+RCSID("$Header: /afs/cmf/project/cvsroot/openafs/src/lwp/process.c,v 1.7 2001/08/06 16:03:15 chas Exp $");
 
 #include <stdio.h>
 #include <assert.h>
@@ -27,6 +27,59 @@
 extern char PRE_Block;             /* used in lwp.c and process.s */
 #endif
 
+#ifdef HAVE_UCONTEXT_H
+
+afs_int32
+savecontext(ep, savearea, newsp)
+char	(*ep)();
+struct lwp_context *savearea;
+char*	newsp;
+{
+#if defined(AFS_IA64_LINUX20_ENV)
+	register unsigned long sp __asm__("r12");
+#else
+#error	"You need to update stack pointer register for this platform"
+#endif
+
+	PRE_Block = 1;
+
+	savearea->state = 0;
+	getcontext(&savearea->ucontext);
+	savearea->topstack = sp;
+	switch (savearea->state)
+	{
+		case 0:
+			if (newsp)
+			{
+				ucontext_t thread;
+
+				getcontext(&thread);
+				thread.uc_stack.ss_sp = newsp - AFS_LWP_MINSTACKSIZE + sizeof(void *) + sizeof(void *);
+				thread.uc_stack.ss_size = AFS_LWP_MINSTACKSIZE - sizeof(void *);
+				makecontext(&thread, ep, 0);
+				setcontext(&thread);
+			}
+			else
+				(*ep)();
+			break;
+		case 2:
+			break;
+	}
+	return 0;
+}
+
+void
+returnto(savearea)
+struct lwp_context *savearea;
+{
+	PRE_Block = 0;
+
+	savearea->state = 2;
+	setcontext(&savearea->ucontext);
+}
+
+#else
+
 /*
  * Magic stack pointer
  */
@@ -169,3 +222,4 @@
 	return 0;
 }
 
+#endif
Index: src/rx/rx.h
===================================================================
RCS file: /afs/cmf/project/cvsroot/openafs/src/rx/rx.h,v
retrieving revision 1.1.1.4
retrieving revision 1.2
diff -u -u -r1.1.1.4 -r1.2
--- rx.h	2001/07/28 17:47:34	1.1.1.4
+++ rx.h	2001/07/29 16:23:02	1.2
@@ -54,6 +54,7 @@
 # include "rx_event.h"
 # include "rx_packet.h"
 # include "rx_misc.h"
+# include "rx_null.h"
 #ifndef AFS_NT40_ENV
 # include <netinet/in.h>
 #endif