From: Chas Williams Date: Tue, 7 Aug 2001 01:11:25 +0000 (+0000) Subject: introduce-linux-ia64-port-20010806 X-Git-Tag: BP-openafs-stable-1_2_x~65 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=a1b425f76746f9e56605eafd7c495ef21b84ad45;p=packages%2Fo%2Fopenafs.git introduce-linux-ia64-port-20010806 "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." ==================== This delta was composed from multiple commits as part of the CVS->Git migration. The checkin message with each commit was inconsistent. The following are the additional commit messages. ==================== don't leak into not ia64 port --- diff --git a/configure.in b/configure.in index d1c7213a1..2bd0aa6a3 100644 --- a/configure.in +++ b/configure.in @@ -215,6 +215,9 @@ else mips-sgi-irix6.5) AFS_SYSNAME="sgi_65" ;; + ia64-*-linux*) + AFS_SYSNAME="ia64_linuxXX" + ;; powerpc-*-linux*) AFS_SYSNAME="ppc_linuxXX" ;; diff --git a/src/afs/LINUX/osi_alloc.c b/src/afs/LINUX/osi_alloc.c index 043c151f1..9169ed624 100644 --- a/src/afs/LINUX/osi_alloc.c +++ b/src/afs/LINUX/osi_alloc.c @@ -19,6 +19,7 @@ RCSID("$Header$"); #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 @@ static void *linux_alloc(unsigned int asize) /* 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; } diff --git a/src/afs/LINUX/osi_groups.c b/src/afs/LINUX/osi_groups.c index b7cbe1f79..bd6f69529 100644 --- a/src/afs/LINUX/osi_groups.c +++ b/src/afs/LINUX/osi_groups.c @@ -100,8 +100,8 @@ int setpag(cred_t **cr, afs_uint32 pagvalue, afs_uint32 *newpag, int change_pare /* 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(); diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h index 6640fbe33..22fa1dd71 100644 --- a/src/afs/LINUX/osi_machdep.h +++ b/src/afs/LINUX/osi_machdep.h @@ -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 diff --git a/src/afs/LINUX/osi_module.c b/src/afs/LINUX/osi_module.c index a9afd97f9..c3e0194ab 100644 --- a/src/afs/LINUX/osi_module.c +++ b/src/afs/LINUX/osi_module.c @@ -22,6 +22,11 @@ RCSID("$Header$"); #include "../h/mm.h" #include +#include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) +#include +#endif + #ifdef AFS_SPARC64_LINUX24_ENV @@ -33,7 +38,7 @@ asmlinkage int (*sys_settimeofdayp)(struct timeval *tv, struct timezone *tz); 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 @@ __asm__ __volatile__ (" } #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 @@ asmlinkage int (*sys_setgroups32p)(int gidsetsize, __kernel_gid32_t *grouplist); #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 @@ int init_module(void) #endif #endif + + /* obtain PAGE_OFFSET value */ afs_linux_page_offset = get_page_offset(); @@ -121,64 +193,117 @@ int init_module(void) #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 ( +#if defined(AFS_IA64_LINUX20_ENV) + SYSCALL2POINTER sys_call_table[__NR_afs_syscall - 1024] +#else + SYSCALL2POINTER sys_call_table[__NR_afs_syscall] +#endif + == 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 +312,15 @@ void cleanup_module(void) 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; diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c index e1cd1dc23..d17dd8a93 100644 --- a/src/afs/afs_call.c +++ b/src/afs/afs_call.c @@ -842,7 +842,7 @@ copyin_iparam(caddr_t cmarg, struct iparam *dst) } #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 diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index 2ef14a3a8..23cbcfbce 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -200,7 +200,7 @@ copyin_afs_ioctl(caddr_t cmarg, struct afs_ioctl *dst) } #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 @@ afs_syscall_pioctl(path, com, cmarg, follow) #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 @@ afs_HandlePioctl(avc, acom, ablob, afollow, acred) 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; diff --git a/src/config/afs_sysnames.h b/src/config/afs_sysnames.h index 84e3ef7fd..c984c7d61 100644 --- a/src/config/afs_sysnames.h +++ b/src/config/afs_sysnames.h @@ -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) diff --git a/src/config/param.ia64_linux24.h b/src/config/param.ia64_linux24.h new file mode 100644 index 000000000..7d9254c9b --- /dev/null +++ b/src/config/param.ia64_linux24.h @@ -0,0 +1,80 @@ +/* Copyright (C) 1998 by Transarc Corporation */ + + +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, + * it's a judgment call. If something is obviously ia64 specific, use that + * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2" + * in the sysname is the current version of the client. This takes into + * account the perferred OS user space configuration as well as the kernel. + */ + +#define AFS_LINUX20_ENV 1 +#define AFS_LINUX22_ENV 1 +#define AFS_LINUX24_ENV 1 +#define AFS_IA64_LINUX20_ENV 1 +#define AFS_IA64_LINUX22_ENV 1 +#define AFS_IA64_LINUX24_ENV 1 +#define AFS_LINUX_64BIT_KERNEL 1 +#define AFS_NONFSTRANS 1 + +#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ +#define AFS_SYSCALL 1141 +#define AFS_64BIT_IOPS_ENV 1 +#define AFS_NAMEI_ENV 1 /* User space interface to file system */ + +#define AFS_64BIT_ENV 1 /* Defines afs_int32 as int, not long. */ + +#define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */ + +#if defined(__KERNEL__) && !defined(KDUMP_KERNEL) +#include +#ifdef CONFIG_SMP +#undef CONFIG_SMP +#endif +/* Using "AFS_SMP" to map to however many #define's are required to get + * MP to compile for Linux + */ +#ifdef AFS_SMP +#define CONFIG_SMP +#ifndef __SMP__ +#define __SMP__ +#endif +#define AFS_GLOBAL_SUNLOCK +#endif + +#if defined(MODULE) && defined(CONFIG_MODVERSIONS) +#define MODVERSIONS +#include +#endif + +#endif /* __KERNEL__ && !DUMP_KERNEL*/ + +#include + +#define AFS_USERSPACE_IP_ADDR 1 +#define RXK_LISTENER_ENV 1 +#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ + +/* Machine / Operating system information */ +#define SYS_NAME "ia64_linux24" +#define SYS_NAME_ID SYS_NAME_ID_ia64_linux24 +#define AFSLITTLE_ENDIAN 1 +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ +#define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */ +#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ + +#ifdef KERNEL +#ifndef MIN +#define MIN(A,B) ((A) < (B) ? (A) : (B)) +#endif +#ifndef MAX +#define MAX(A,B) ((A) > (B) ? (A) : (B)) +#endif +#endif /* KERNEL */ + +#define HAVE_UCONTEXT_H /* should be in afsconfig.h */ + +#endif /* _PARAM_IA64_LINUX20_H_ */ diff --git a/src/config/param.ia64_linux24_usr.h b/src/config/param.ia64_linux24_usr.h new file mode 100644 index 000000000..a15d41e0a --- /dev/null +++ b/src/config/param.ia64_linux24_usr.h @@ -0,0 +1,59 @@ +/* Copyright (C) 1998 by Transarc Corporation */ + + +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, + * it's a judgment call. If something is obviously ia64 specific, use that + * #define instead. Note that "20" refers to the linux 2.0 kernel. The "2" + * in the sysname is the current version of the client. This takes into + * account the perferred OS user space configuration as well as the kernel. + */ + +#define UKERNEL 1 /* user space kernel */ +#define AFS_ENV 1 +#define AFS_USR_LINUX20_ENV 1 +#define AFS_USR_LINUX22_ENV 1 +#define AFS_USR_LINUX24_ENV 1 +#define AFS_NONFSTRANS 1 + +#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ +#define AFS_SYSCALL 1141 +#define AFS_64BIT_IOPS_ENV 1 +#define AFS_NAMEI_ENV 1 /* User space interface to file system */ +#include + +#define AFS_USERSPACE_IP_ADDR 1 +#define RXK_LISTENER_ENV 1 +#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ + + +/* Machine / Operating system information */ +#define SYS_NAME "ia64_linux24" +#define SYS_NAME_ID SYS_NAME_ID_ia64_linux24 +#define AFSLITTLE_ENDIAN 1 +#define AFS_HAVE_FFS 1 /* Use system's ffs. */ +#define AFS_HAVE_STATVFS 0 /* System doesn't support statvfs */ +#define AFS_VM_RDWR_ENV 1 /* read/write implemented via VM */ + +#define afsio_iov uio_iov +#define afsio_iovcnt uio_iovcnt +#define afsio_offset uio_offset +#define afsio_seg uio_segflg +#define afsio_fmode uio_fmode +#define afsio_resid uio_resid +#define AFS_UIOSYS 1 +#define AFS_UIOUSER UIO_USERSPACE +#define AFS_CLBYTES MCLBYTES +#define AFS_MINCHANGE 2 +#define VATTR_NULL usr_vattr_null + +#define AFS_DIRENT +#ifndef CMSERVERPREF +#define CMSERVERPREF +#endif + +#define HAVE_UCONTEXT_H /* should be in afsconfig.h */ + +#endif /* AFS_PARAM_H */ diff --git a/src/des/andrew-conf.h b/src/des/andrew-conf.h index 6a730b8f4..c294e857a 100644 --- a/src/des/andrew-conf.h +++ b/src/des/andrew-conf.h @@ -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 */ diff --git a/src/des/conf-ia64-linux.h b/src/des/conf-ia64-linux.h new file mode 100644 index 000000000..8118f4cf1 --- /dev/null +++ b/src/des/conf-ia64-linux.h @@ -0,0 +1,13 @@ +/* + * Copyright 1988 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * . + * + */ + +#include + +#define BITS32 +#define BIG +#define LSBFIRST diff --git a/src/des/crypt.c b/src/des/crypt.c index ccc816d90..96b3797e9 100644 --- a/src/des/crypt.c +++ b/src/des/crypt.c @@ -249,8 +249,13 @@ typedef union { 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; @@ -501,6 +506,7 @@ crypt(key, setting) int num_iter, salt_size; C_block keyblock, rsltblock; + for (i = 0; i < 8; i++) { if ((t = 2*(unsigned char)(*key)) != 0) key++; diff --git a/src/dir/buffer.c b/src/dir/buffer.c index 512de41de..5d00736bc 100644 --- a/src/dir/buffer.c +++ b/src/dir/buffer.c @@ -12,6 +12,7 @@ RCSID("$Header$"); +#include #include #include "dir.h" diff --git a/src/libafs/MakefileProto.LINUX.in b/src/libafs/MakefileProto.LINUX.in index eaf052cbc..2428ed0e3 100644 --- a/src/libafs/MakefileProto.LINUX.in +++ b/src/libafs/MakefileProto.LINUX.in @@ -67,6 +67,10 @@ CCFLAGS = -O2 -fomit-frame-pointer -fno-strength-reduce \ -fno-strict-aliasing -fsigned-char -msoft-float -pipe \ -fno-builtin -ffixed-r2 DEFINES = -D__KERNEL__ -D__powerpc__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF} + +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 INCLUDES = -I. -I../ -I${TOP_SRCDIR}/config @@ -124,6 +128,8 @@ ${COMPDIRS}: ln -s ${LINUX_KERNEL_PATH}/include/asm-sparc asm ln -s ${LINUX_KERNEL_PATH}/include/asm-sparc64 asm + + ln -s ${LINUX_KERNEL_PATH}/include/asm-ia64 asm for m in ${MPS} ; do \ KDIR=${KOBJ}-${LINUX_VERS}${LINUX_MODULE_NAME}-$$m ; \ diff --git a/src/lwp/lwp.h b/src/lwp/lwp.h index 8859ffafd..4ae8096e7 100644 --- a/src/lwp/lwp.h +++ b/src/lwp/lwp.h @@ -20,7 +20,11 @@ #if !defined(KERNEL) && !defined(_KMEMUSER) && !defined(AFS_PTHREAD_ENV) #include +#ifdef HAVE_UCONTEXT_H +#include +#else #include +#endif #define LWP_SUCCESS 0 #define LWP_EBADPID -1 @@ -191,14 +195,19 @@ typedef struct lwp_pcb { #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 diff --git a/src/lwp/process.c b/src/lwp/process.c index 3312019f9..b3a531789 100644 --- a/src/lwp/process.c +++ b/src/lwp/process.c @@ -27,6 +27,59 @@ extern int PRE_Block; /* used in lwp.c and process.s */ 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 @@ struct lwp_context *savearea; return 0; } +#endif diff --git a/src/rx/rx.h b/src/rx/rx.h index addb64cff..79ab60835 100644 --- a/src/rx/rx.h +++ b/src/rx/rx.h @@ -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 #endif