From 928c5e686bf508b60820e015c405f7d155ba4d90 Mon Sep 17 00:00:00 2001 From: Pavel Semerad Date: Sun, 24 Dec 2000 00:51:17 +0000 Subject: [PATCH] sparc-linux-20001223 Sparc/Sparc64 linux support --- src/Makefile | 2 +- src/afs/LINUX/osi_alloc.c | 12 ++--- src/afs/LINUX/osi_cred.c | 4 +- src/afs/LINUX/osi_file.c | 4 +- src/afs/LINUX/osi_groups.c | 19 ++++++++ src/afs/LINUX/osi_machdep.h | 8 ++++ src/afs/LINUX/osi_misc.c | 8 ++++ src/afs/LINUX/osi_module.c | 59 ++++++++++++++++++++----- src/afs/LINUX/osi_vnodeops.c | 3 +- src/afs/VNOPS/afs_vnop_lookup.c | 4 ++ src/afs/VNOPS/afs_vnop_readdir.c | 4 ++ src/afs/afs.h | 4 ++ src/afs/afs_call.c | 21 +++++++-- src/afs/afs_osi.h | 2 +- src/afs/afs_pioctl.c | 17 +++++++ src/afs/exporter.h | 2 +- src/config/Makefile.sparc64_linux22 | 50 +++++++++++++++++++++ src/config/Makefile.sparc_linux22 | 50 +++++++++++++++++++++ src/config/afs_sysnames.h | 5 +++ src/config/param.sparc64_linux22.h | 79 +++++++++++++++++++++++++++++++++ src/config/param.sparc64_linux22_usr.h | 56 +++++++++++++++++++++++ src/config/param.sparc_linux22.h | 81 ++++++++++++++++++++++++++++++++++ src/config/param.sparc_linux22_usr.h | 56 +++++++++++++++++++++++ src/des/andrew-conf.h | 8 ++++ src/des/conf-sparc-linux.h | 15 +++++++ src/des/conf-sparc64-linux.h | 15 +++++++ src/libafs/MakefileProto.LINUX | 15 +++++++ src/lwp/lwp.c | 11 +++++ src/lwp/lwp.h | 2 +- src/lwp/preempt.c | 2 +- src/lwp/process.c | 13 +++++- src/rx/rx.c | 2 +- src/rx/rx_clock.h | 2 +- src/venus/fstrace.c | 17 +++++++ src/venus/kdump.c | 9 ++-- src/volser/volmain.c | 2 +- 36 files changed, 626 insertions(+), 37 deletions(-) create mode 100644 src/config/Makefile.sparc64_linux22 create mode 100644 src/config/Makefile.sparc_linux22 create mode 100644 src/config/param.sparc64_linux22.h create mode 100644 src/config/param.sparc64_linux22_usr.h create mode 100644 src/config/param.sparc_linux22.h create mode 100644 src/config/param.sparc_linux22_usr.h create mode 100644 src/des/conf-sparc-linux.h create mode 100644 src/des/conf-sparc64-linux.h diff --git a/src/Makefile b/src/Makefile index 71293bd..59a3995 100644 --- a/src/Makefile +++ b/src/Makefile @@ -69,7 +69,7 @@ comerr: basics util cmd: basics comerr ${COMPILE_PART1} cmd ${COMPILE_PART2} @case ${SYS_NAME} in \ - sgi_6* | sun4x_57 | sun4x_58 | hp_ux11* ) \ + sgi_6* | sun4x_57 | sun4x_58 | hp_ux11* | sparc64_linux* ) \ ${COMPILE_PART1} cmd ${COMPILE_PART2} install64 ;; \ esac diff --git a/src/afs/LINUX/osi_alloc.c b/src/afs/LINUX/osi_alloc.c index 3b8d6dc..f076d7e 100644 --- a/src/afs/LINUX/osi_alloc.c +++ b/src/afs/LINUX/osi_alloc.c @@ -32,8 +32,8 @@ struct osi_linux_mem { }; /* These assume 32-bit pointers */ -#define MEMTYPE(A) (((unsigned int)A) & 0x3) -#define MEMADDR(A) (void *)((unsigned int)(A) & (~0x3)) +#define MEMTYPE(A) (((unsigned long)A) & 0x3) +#define MEMADDR(A) (void *)((unsigned long)(A) & (~0x3)) /* globals */ afs_atomlist *al_mem_pool; /* pool of osi_linux_mem structures */ @@ -82,9 +82,9 @@ 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 *)kmalloc(asize, GFP_KERNEL); + new = (void *)(long)kmalloc(asize, GFP_KERNEL); if (new) /* piggy back alloc type */ - (unsigned int)new |= KM_TYPE; + (unsigned long)new |= KM_TYPE; } if (!new) { /* otherwise use vmalloc */ int max_wait = 10; @@ -95,7 +95,7 @@ static void *linux_alloc(unsigned int asize) schedule(); } if (new) /* piggy back alloc type */ - (unsigned int)new |= VM_TYPE; + (unsigned long)new |= VM_TYPE; } if (new) memset(MEMADDR(new), 0, asize); @@ -139,7 +139,7 @@ static unsigned hash_chunk(void *p) { unsigned int key; - key = (unsigned int)p >> 2; + key = (unsigned int)(long)p >> 2; key = (key * HASH_CONST)%HASH_PRIME; return key; diff --git a/src/afs/LINUX/osi_cred.c b/src/afs/LINUX/osi_cred.c index f452e03..14643fd 100644 --- a/src/afs/LINUX/osi_cred.c +++ b/src/afs/LINUX/osi_cred.c @@ -48,7 +48,7 @@ cred_t *crget(void) osi_Panic("crget: No more memory for creds!\n"); for (i=0; i < CRED_ALLOC_STEP-1; i++) - cred_pool[i].cr_ref = (int)&cred_pool[i+1]; + cred_pool[i].cr_ref = (long)&cred_pool[i+1]; cred_pool[i].cr_ref = 0; } tmp = cred_pool; @@ -69,7 +69,7 @@ void crfree(cred_t *cr) } CRED_LOCK(); - cr->cr_ref = (int)cred_pool; + cr->cr_ref = (long)cred_pool; cred_pool = cr; CRED_UNLOCK(); ncreds_inuse --; diff --git a/src/afs/LINUX/osi_file.c b/src/afs/LINUX/osi_file.c index bb57725..7f3ed0f 100644 --- a/src/afs/LINUX/osi_file.c +++ b/src/afs/LINUX/osi_file.c @@ -181,7 +181,7 @@ afs_osi_Read(afile, offset, aptr, asize) char *aptr; afs_int32 asize; { struct AFS_UCRED *oldCred; - unsigned int resid; + size_t resid; register afs_int32 code; register afs_int32 cnt1=0; AFS_STATCNT(osi_Read); @@ -220,7 +220,7 @@ afs_osi_Write(afile, offset, aptr, asize) afs_int32 offset; afs_int32 asize; { struct AFS_UCRED *oldCred; - unsigned int resid; + size_t resid; register afs_int32 code; AFS_STATCNT(osi_Write); if ( !afile ) diff --git a/src/afs/LINUX/osi_groups.c b/src/afs/LINUX/osi_groups.c index 09b97f7..d890693 100644 --- a/src/afs/LINUX/osi_groups.c +++ b/src/afs/LINUX/osi_groups.c @@ -126,6 +126,25 @@ asmlinkage int afs_xsetgroups(int gidsetsize, gid_t *grouplist) return code; } +#ifdef AFS_SPARC64_LINUX20_ENV +asmlinkage int afs_xsetgroups32(int gidsetsize, __kernel_gid_t32 *grouplist) +{ + gid_t gl[NGROUPS]; + int ret, i; + mm_segment_t old_fs = get_fs (); + + if ((unsigned) gidsetsize > NGROUPS) + return -EINVAL; + for (i = 0; i < gidsetsize; i++, grouplist++) + if (__get_user (gl[i], grouplist)) + return -EFAULT; + set_fs (KERNEL_DS); + ret = afs_xsetgroups(gidsetsize, gl); + set_fs (old_fs); + return ret; +} +#endif + static int afs_setgroups(cred_t **cr, int ngroups, gid_t *gidset, int change_parent) { int ngrps; diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h index c192e96..6640fbe 100644 --- a/src/afs/LINUX/osi_machdep.h +++ b/src/afs/LINUX/osi_machdep.h @@ -30,7 +30,11 @@ #define afs_hz HZ #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) +#else #define osi_GetTime(V) (*(V)=xtime) +#endif #undef gop_lookupname #define gop_lookupname osi_lookupname @@ -89,7 +93,11 @@ extern struct vnodeops afs_dir_iops, afs_symlink_iops; /* cred struct */ typedef struct cred { /* maps to task field: */ +#if (CPU == sparc64) + long cr_ref; +#else int cr_ref; +#endif unsigned short cr_uid; /* euid */ unsigned short cr_ruid; /* uid */ unsigned short cr_gid; /* egid */ diff --git a/src/afs/LINUX/osi_misc.c b/src/afs/LINUX/osi_misc.c index edda974..1478be6 100644 --- a/src/afs/LINUX/osi_misc.c +++ b/src/afs/LINUX/osi_misc.c @@ -264,6 +264,13 @@ int uiomove(char *dp, int length, uio_flag_t rw, uio_t *uiop) void afs_osi_SetTime(osi_timeval_t *tvp) { extern int (*sys_settimeofdayp)(struct timeval *tv, struct timezone *tz); +#ifdef AFS_LINUX_64BIT_KERNEL + struct timeval tv; + AFS_STATCNT(osi_SetTime); + tv.tv_sec = tvp->tv_sec; + tv.tv_usec = tvp->tv_usec; + (void) (*sys_settimeofdayp)(&tv, NULL); +#else KERNEL_SPACE_DECL; AFS_STATCNT(osi_SetTime); @@ -271,6 +278,7 @@ void afs_osi_SetTime(osi_timeval_t *tvp) TO_USER_SPACE(); (void) (*sys_settimeofdayp)(tvp, NULL); TO_KERNEL_SPACE(); +#endif } /* Free all the pages on any of the vnodes in the vlru. Must be done before diff --git a/src/afs/LINUX/osi_module.c b/src/afs/LINUX/osi_module.c index 5d29b43..c3c29b5 100644 --- a/src/afs/LINUX/osi_module.c +++ b/src/afs/LINUX/osi_module.c @@ -26,7 +26,7 @@ asmlinkage int (*sys_socketcallp)(int call, long *args); asmlinkage int (*sys_killp)(int pid, int signal); asmlinkage int (*sys_setgroupsp)(int gidsetsize, gid_t *grouplist); -extern void *sys_call_table[]; +extern unsigned int sys_call_table[]; /* changed to uint because SPARC64 has syscaltable of 32bit items */ extern struct file_system_type afs_file_system; static long get_page_offset(void); @@ -42,12 +42,37 @@ unsigned long afs_linux_page_offset = 0; /* contains the PAGE_OFFSET value */ /* Since sys_ni_syscall is not exported, I need to cache it in order to restore * it. */ -static void *afs_ni_syscall = NULL; +static unsigned int afs_ni_syscall = 0; + +#ifdef AFS_SPARC64_LINUX20_ENV +static unsigned int afs_ni_syscall32 = 0; +asmlinkage int (*sys_setgroupsp32)(int gidsetsize, __kernel_gid_t32 *grouplist); +extern unsigned int sys_call_table32[]; + +asmlinkage int afs_syscall32(long syscall, long parm1, long parm2, long parm3, + long parm4, long parm5) +{ +__asm__ __volatile__ (" + srl %o4, 0, %o4 + mov %o7, %i7 + call afs_syscall + srl %o5, 0, %o5 + ret + nop +"); +} +#endif + +#define POINTER2SYSCALL (unsigned int)(unsigned long) +#define SYSCALL2POINTER (void *)(long) int init_module(void) { extern int afs_syscall(); extern int afs_xsetgroups(); +#ifdef AFS_SPARC64_LINUX20_ENV + extern int afs_xsetgroups32(); +#endif /* obtain PAGE_OFFSET value */ afs_linux_page_offset = get_page_offset(); @@ -59,26 +84,34 @@ int init_module(void) } /* Initialize pointers to kernel syscalls. */ - sys_settimeofdayp = sys_call_table[__NR_settimeofday]; - sys_socketcallp = sys_call_table[__NR_socketcall]; - sys_killp = sys_call_table[__NR_kill]; + sys_settimeofdayp = SYSCALL2POINTER sys_call_table[__NR_settimeofday]; + sys_socketcallp = SYSCALL2POINTER sys_call_table[__NR_socketcall]; + sys_killp = SYSCALL2POINTER sys_call_table[__NR_kill]; /* setup AFS entry point. */ - if (sys_call_table[__NR_afs_syscall] == afs_syscall) { + if (SYSCALL2POINTER sys_call_table[__NR_afs_syscall] == afs_syscall) { printf("AFS syscall entry point already in use!\n"); return -EBUSY; } afs_ni_syscall = sys_call_table[__NR_afs_syscall]; - sys_call_table[__NR_afs_syscall] = afs_syscall; + sys_call_table[__NR_afs_syscall] = POINTER2SYSCALL afs_syscall; +#ifdef AFS_SPARC64_LINUX20_ENV + afs_ni_syscall32 = sys_call_table32[__NR_afs_syscall]; + sys_call_table32[__NR_afs_syscall] = POINTER2SYSCALL afs_syscall32; +#endif osi_Init(); register_filesystem(&afs_file_system); /* Intercept setgroups calls */ - sys_setgroupsp = sys_call_table[__NR_setgroups]; - sys_call_table[__NR_setgroups] = afs_xsetgroups; + sys_setgroupsp = SYSCALL2POINTER sys_call_table[__NR_setgroups]; + sys_call_table[__NR_setgroups] = POINTER2SYSCALL afs_xsetgroups; +#ifdef AFS_SPARC64_LINUX20_ENV + sys_setgroupsp32 = SYSCALL2POINTER sys_call_table32[__NR_setgroups]; + sys_call_table32[__NR_setgroups] = POINTER2SYSCALL afs_xsetgroups32; +#endif return 0; } @@ -87,8 +120,12 @@ void cleanup_module(void) { struct task_struct *t; - sys_call_table[__NR_setgroups] = sys_setgroupsp; + sys_call_table[__NR_setgroups] = POINTER2SYSCALL sys_setgroupsp; sys_call_table[__NR_afs_syscall] = afs_ni_syscall; +#ifdef AFS_SPARC64_LINUX20_ENV + sys_call_table32[__NR_setgroups] = POINTER2SYSCALL sys_setgroupsp32; + sys_call_table32[__NR_afs_syscall] = afs_ni_syscall32; +#endif unregister_filesystem(&afs_file_system); @@ -100,7 +137,7 @@ void cleanup_module(void) static long get_page_offset(void) { -#if defined(AFS_PPC_LINUX22_ENV) +#if defined(AFS_PPC_LINUX22_ENV) || defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) return PAGE_OFFSET; #else struct task_struct *p; diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index d1894e7..2bc8287 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -146,6 +146,7 @@ static ssize_t afs_linux_write(struct file *fp, const char *buf, size_t count, static int afs_linux_readdir(struct file *fp, void *dirbuf, filldir_t filldir) { + extern struct DirEntry * afs_dir_GetBlob(); struct vcache *avc = (struct vcache*)FILE_INODE(fp); struct vrequest treq; register struct dcache *tdc; @@ -525,7 +526,7 @@ int afs_linux_flush(struct file *fp) } /* Not allowed to directly read a directory. */ -int afs_linux_dir_read(struct file *fp, char *buf, size_t count, loff_t *ppos) +ssize_t afs_linux_dir_read(struct file *fp, char *buf, size_t count, loff_t *ppos) { return -EISDIR; } diff --git a/src/afs/VNOPS/afs_vnop_lookup.c b/src/afs/VNOPS/afs_vnop_lookup.c index c02fcfb..aaed884 100644 --- a/src/afs/VNOPS/afs_vnop_lookup.c +++ b/src/afs/VNOPS/afs_vnop_lookup.c @@ -325,8 +325,12 @@ void afs_HandleAtName(aname, aresult, areq, adp) #if (defined(AFS_SGI62_ENV) || defined(AFS_SUN57_64BIT_ENV)) extern int BlobScan(ino64_t *afile, afs_int32 ablob); #else +#if defined AFS_LINUX_64BIT_KERNEL +extern int BlobScan(long *afile, afs_int32 ablob); +#else extern int BlobScan(afs_int32 *afile, afs_int32 ablob); #endif +#endif /* called with an unlocked directory and directory cookie. Areqp diff --git a/src/afs/VNOPS/afs_vnop_readdir.c b/src/afs/VNOPS/afs_vnop_readdir.c index d2bbbf5..3818dd1 100644 --- a/src/afs/VNOPS/afs_vnop_readdir.c +++ b/src/afs/VNOPS/afs_vnop_readdir.c @@ -59,8 +59,12 @@ extern struct DirEntry * afs_dir_GetBlob(); #if defined(AFS_SGI62_ENV) || defined(AFS_SUN57_64BIT_ENV) int BlobScan(ino64_t *afile, afs_int32 ablob) #else +#ifdef AFS_LINUX_64BIT_KERNEL +int BlobScan(long *afile, afs_int32 ablob) +#else int BlobScan(afs_int32 *afile, afs_int32 ablob) #endif +#endif { register afs_int32 relativeBlob; afs_int32 pageBlob; diff --git a/src/afs/afs.h b/src/afs/afs.h index adca1b8..12e3a5a 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -809,8 +809,12 @@ struct fcache { */ ino64_t inode; /* Unix inode for this chunk */ #else +#if defined(AFS_LINUX_64BIT_KERNEL) + long inode; /* Unix inode for this chunk */ +#else afs_int32 inode; /* Unix inode for this chunk */ #endif +#endif afs_int32 chunkBytes; /* Num bytes in this chunk */ char states; /* Has this chunk been modified? */ }; diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c index 1792e2c..27beb93 100644 --- a/src/afs/afs_call.c +++ b/src/afs/afs_call.c @@ -816,6 +816,21 @@ copyin_iparam(caddr_t cmarg, struct iparam *dst) } #endif /* AFS_SUN57_64BIT_ENV */ +#if defined(AFS_LINUX_64BIT_KERNEL) + struct iparam32 dst32; + +#ifdef AFS_SPARC64_LINUX20_ENV + if (current->tss.flags & SPARC_FLAG_32BIT) { +#else +#error Not done for this linux version +#endif + AFS_COPYIN(cmarg, (caddr_t) &dst32, sizeof dst32, code); + if (!code) + iparam32_to_iparam(&dst32, dst); + return code; + } +#endif /* AFS_LINUX_64BIT_KERNEL */ + AFS_COPYIN(cmarg, (caddr_t) dst, sizeof *dst, code); return code; } @@ -888,9 +903,9 @@ asmlinkage int afs_syscall(long syscall, long parm1, long parm2, long parm3, long parm4) { struct afssysargs args, *uap = &args; - int linux_ret=0; - int *retval = &linux_ret; - int eparm[4]; /* matches AFSCALL_ICL in fstrace.c */ + long linux_ret=0; + long *retval = &linux_ret; + long eparm[4]; /* matches AFSCALL_ICL in fstrace.c */ #else #if defined(UKERNEL) Afs_syscall () diff --git a/src/afs/afs_osi.h b/src/afs/afs_osi.h index 4586e44..9676fb3 100644 --- a/src/afs/afs_osi.h +++ b/src/afs/afs_osi.h @@ -154,7 +154,7 @@ extern struct vnodeops *afs_ops; */ -#if defined(AFS_HPUX_ENV) || defined(AFS_SUN57_ENV) || (defined(AFS_SGI61_ENV) && defined(KERNEL) && defined(_K64U64)) +#if defined(AFS_HPUX_ENV) || defined(AFS_SUN57_ENV) || defined(AFS_LINUX_64BIT_KERNEL) || (defined(AFS_SGI61_ENV) && defined(KERNEL) && defined(_K64U64)) typedef struct { afs_int32 tv_sec; afs_int32 tv_usec; diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index b48eca1..1eeb449 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -180,6 +180,21 @@ copyin_afs_ioctl(caddr_t cmarg, struct afs_ioctl *dst) } #endif /* defined(AFS_SGI_ENV) && (_MIPS_SZLONG==64) */ +#if defined(AFS_LINUX_64BIT_KERNEL) + struct afs_ioctl32 dst32; + +#ifdef AFS_SPARC64_LINUX20_ENV + if (current->tss.flags & SPARC_FLAG_32BIT) { +#else +#error Not done for this linux type +#endif + AFS_COPYIN(cmarg, (caddr_t) &dst32, sizeof dst32, code); + if (!code) + afs_ioctl32_to_afs_ioctl(&dst32, dst); + return code; + } +#endif /* defined(AFS_LINUX_64BIT_KERNEL) */ + AFS_COPYIN(cmarg, (caddr_t) dst, sizeof *dst, code); return code; } @@ -3318,8 +3333,10 @@ afs_int32 *aoutSize; if ( ainSize < sizeof(struct setspref) ) return EINVAL; +#if 0 /* num_servers is unsigned */ if ( sin->num_servers < 0 ) return EINVAL; +#endif if ( sin->num_servers > AFS_MAX_INTERFACE_ADDR) return ENOMEM; diff --git a/src/afs/exporter.h b/src/afs/exporter.h index da17b1e..974cf8e 100644 --- a/src/afs/exporter.h +++ b/src/afs/exporter.h @@ -33,7 +33,7 @@ * up 2 bytes */ -#if defined(AFS_SUN57_64BIT_ENV) || defined(AFS_OSF_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZPTR==64)) +#if defined(AFS_SUN57_64BIT_ENV) || defined(AFS_OSF_ENV) || (defined(AFS_SGI61_ENV) && (_MIPS_SZPTR==64)) || defined(AFS_LINUX_64BIT_KERNEL) #define AFS_XLATOR_MAGIC 0x8765 /* XXX */ #else #define AFS_XLATOR_MAGIC 0x87654321 diff --git a/src/config/Makefile.sparc64_linux22 b/src/config/Makefile.sparc64_linux22 new file mode 100644 index 0000000..65e4f2b --- /dev/null +++ b/src/config/Makefile.sparc64_linux22 @@ -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.2.14 + +# +# compilation and link editor flags +DBG=-g +OPTMZ=-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= +# +# programs +AR=ar +AS=as +CP=cp +INSTALL=${SRCDIR}bin/install +LD=ld +MT_CC=cc +MV=mv +RANLIB=ranlib +RM=rm +WASHTOOL=${SRCDIR}bin/washtool +# +# Other OS specific requirements +# +YACC = bison -y +LEX = flex -l +# Used in des library. +CRYPT_OBJ = crypt.o diff --git a/src/config/Makefile.sparc_linux22 b/src/config/Makefile.sparc_linux22 new file mode 100644 index 0000000..65e4f2b --- /dev/null +++ b/src/config/Makefile.sparc_linux22 @@ -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.2.14 + +# +# compilation and link editor flags +DBG=-g +OPTMZ=-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= +# +# programs +AR=ar +AS=as +CP=cp +INSTALL=${SRCDIR}bin/install +LD=ld +MT_CC=cc +MV=mv +RANLIB=ranlib +RM=rm +WASHTOOL=${SRCDIR}bin/washtool +# +# Other OS specific requirements +# +YACC = bison -y +LEX = flex -l +# Used in des library. +CRYPT_OBJ = crypt.o diff --git a/src/config/afs_sysnames.h b/src/config/afs_sysnames.h index 33d64d4..32504e4 100644 --- a/src/config/afs_sysnames.h +++ b/src/config/afs_sysnames.h @@ -114,6 +114,11 @@ #define SYS_NAME_ID_ppc_linux22 1601 #define SYS_NAME_ID_ppc_linux24 1602 +#define SYS_NAME_ID_sparc_linux2 1700 +#define SYS_NAME_ID_sparc_linux22 1701 + +#define SYS_NAME_ID_sparc64_linux2 1800 +#define SYS_NAME_ID_sparc64_linux22 1801 /* diff --git a/src/config/param.sparc64_linux22.h b/src/config/param.sparc64_linux22.h new file mode 100644 index 0000000..28f0977 --- /dev/null +++ b/src/config/param.sparc64_linux22.h @@ -0,0 +1,79 @@ +/* Copyright (C) 1998 by Transarc Corporation */ + + +#ifndef _PARAM_SPARC64_LINUX22_H_ +#define _PARAM_SPARC64_LINUX22_H_ + +/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, + * it's a judgment call. If something is obviously sparc64 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_SPARC64_LINUX20_ENV 1 +#define AFS_SPARC64_LINUX22_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 227 +#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_32BIT_USR_ENV 1 /* user level processes are 32bit */ +#define AFS_64BITPOINTER_ENV 1 /* pointers are 64 bits. */ + +#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 "sparc64_linux22" +#define SYS_NAME_ID SYS_NAME_ID_sparc64_linux22 +#define AFSBIG_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 */ + +#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 +#define __SMP__ +#define AFS_GLOBAL_SUNLOCK +#endif + +#endif /* __KERNEL__ && !DUMP_KERNEL*/ + +#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 */ + +/* on sparclinux is O_LARGEFILE defined but there is not off64_t, + so small hack to get usd_file.c work */ +#ifndef KERNEL +#define __USE_FILE_OFFSET64 1 +#define __USE_LARGEFILE64 1 +#if !defined off64_t +#define off64_t __off64_t +#endif +#endif + +#endif /* _PARAM_SPARC64_LINUX20_H_ */ diff --git a/src/config/param.sparc64_linux22_usr.h b/src/config/param.sparc64_linux22_usr.h new file mode 100644 index 0000000..a5c5052 --- /dev/null +++ b/src/config/param.sparc64_linux22_usr.h @@ -0,0 +1,56 @@ +/* Copyright (C) 1998 by Transarc Corporation */ + + +#ifndef _PARAM_USR_SPARC64_LINUX22_H_ +#define _PARAM_USR_SPARC64_LINUX22_H_ + +/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, + * it's a judgment call. If something is obviously sparc64 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_NONFSTRANS 1 + +#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ +#define AFS_SYSCALL 227 +#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 "sparc64_linux22" +#define SYS_NAME_ID SYS_NAME_ID_sparc64_linux22 +#define AFSBIG_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 + +#endif /* _PARAM_USR_SPARC64_LINUX22_H_ */ diff --git a/src/config/param.sparc_linux22.h b/src/config/param.sparc_linux22.h new file mode 100644 index 0000000..f0b4214 --- /dev/null +++ b/src/config/param.sparc_linux22.h @@ -0,0 +1,81 @@ +/* Copyright (C) 1998 by Transarc Corporation */ + + +#ifndef _PARAM_SPARC_LINUX22_H_ +#define _PARAM_SPARC_LINUX22_H_ + +/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, + * it's a judgment call. If something is obviously sparc 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_SPARC_LINUX20_ENV 1 +#define AFS_SPARC_LINUX22_ENV 1 +#define AFS_NONFSTRANS 1 + +#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ +#define AFS_SYSCALL 227 +#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 "sparc_linux22" +#define SYS_NAME_ID SYS_NAME_ID_sparc_linux22 +#define AFSBIG_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 */ + +#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 +#define __SMP__ +#define AFS_GLOBAL_SUNLOCK +#endif + +#endif /* __KERNEL__ && !DUMP_KERNEL*/ + +#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 */ + +#if defined(AFS_SMP) && defined(CONFIG_MODVERSIONS) +/* hack, I don't know what else with theese symbols */ +#define _do_spin_lock _do_spin_lock_R__ver__do_spin_lock +#define _do_spin_unlock _do_spin_unlock_R__ver__do_spin_unlock +#define kernel_flag kernel_flag_R__ver_kernel_flag +#endif + +/* on sparclinux is O_LARGEFILE defined but there is not off64_t, + so small hack to get usd_file.c work */ +#ifndef KERNEL +#define __USE_FILE_OFFSET64 1 +#define __USE_LARGEFILE64 1 +#if !defined off64_t +#define off64_t __off64_t +#endif +#endif + +#endif /* _PARAM_SPARC_LINUX20_H_ */ diff --git a/src/config/param.sparc_linux22_usr.h b/src/config/param.sparc_linux22_usr.h new file mode 100644 index 0000000..4c488a5 --- /dev/null +++ b/src/config/param.sparc_linux22_usr.h @@ -0,0 +1,56 @@ +/* Copyright (C) 1998 by Transarc Corporation */ + + +#ifndef _PARAM_USR_SPARC_LINUX22_H_ +#define _PARAM_USR_SPARC_LINUX22_H_ + +/* In user space the AFS_LINUX20_ENV should be sufficient. In the kernel, + * it's a judgment call. If something is obviously sparc 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_NONFSTRANS 1 + +#define AFS_MOUNT_AFS "afs" /* The name of the filesystem type. */ +#define AFS_SYSCALL 227 +#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 "sparc_linux22" +#define SYS_NAME_ID SYS_NAME_ID_sparc_linux22 +#define AFSBIG_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 + +#endif /* _PARAM_USR_SPARC_LINUX22_H_ */ diff --git a/src/des/andrew-conf.h b/src/des/andrew-conf.h index 5613adf..554b414 100644 --- a/src/des/andrew-conf.h +++ b/src/des/andrew-conf.h @@ -44,7 +44,15 @@ #ifdef AFS_PPC_LINUX20_ENV #include "conf-ppc-linux.h" #else +#ifdef AFS_SPARC_LINUX20_ENV +#include "conf-sparc-linux.h" +#else +#ifdef AFS_SPARC64_LINUX20_ENV +#include "conf-sparc64-linux.h" +#else #include "conf-i386-linux.h" +#endif /* AFS_SPARC64_LINUX20_ENV */ +#endif /* AFS_SPARC_LINUX20_ENV */ #endif #else Sorry, you lose. diff --git a/src/des/conf-sparc-linux.h b/src/des/conf-sparc-linux.h new file mode 100644 index 0000000..90a74d7 --- /dev/null +++ b/src/des/conf-sparc-linux.h @@ -0,0 +1,15 @@ +/* + * Copyright 1988 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * . + * + * Machine-type definitions: Linux on Intel + */ + +#include + +#define BITS32 +#define BIG +#define MSBFIRST +#define MUSTALIGN diff --git a/src/des/conf-sparc64-linux.h b/src/des/conf-sparc64-linux.h new file mode 100644 index 0000000..90a74d7 --- /dev/null +++ b/src/des/conf-sparc64-linux.h @@ -0,0 +1,15 @@ +/* + * Copyright 1988 by the Massachusetts Institute of Technology. + * + * For copying and distribution information, please see the file + * . + * + * Machine-type definitions: Linux on Intel + */ + +#include + +#define BITS32 +#define BIG +#define MSBFIRST +#define MUSTALIGN diff --git a/src/libafs/MakefileProto.LINUX b/src/libafs/MakefileProto.LINUX index ae406bd..62aa3d4 100644 --- a/src/libafs/MakefileProto.LINUX +++ b/src/libafs/MakefileProto.LINUX @@ -41,6 +41,17 @@ CCFLAGS = -O2 -fomit-frame-pointer \ -fno-strength-reduce -pipe -m486 -malign-loops=2 -malign-jumps=2 \ -malign-functions=2 DEFINES = -D__KERNEL__ -DCPU=586 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF} + +LD = ld -m elf32_sparc +CCFLAGS = -O2 -fomit-frame-pointer \ + -fno-strength-reduce -pipe -mcpu=v8 -mno-fpu -fcall-used-g5 -fcall-used-g7 +DEFINES = -D__KERNEL__ -DCPU=sparc -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF} + +CC = sparc64-linux-gcc +LD = ld -m elf64_sparc +CCFLAGS = -O2 -fomit-frame-pointer \ + -fno-strength-reduce -pipe -mcpu=ultrasparc -m64 -mno-fpu -mcmodel=medlow -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare +DEFINES = -D__KERNEL__ -DCPU=sparc64 -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF} CCFLAGS = -O2 -fomit-frame-pointer -fno-strength-reduce \ -fno-strict-aliasing -fsigned-char -msoft-float -pipe \ @@ -95,6 +106,10 @@ ${COMPDIRS}: ln -s ${LINUX_SRCDIR}$$v/include/asm-i386 asm ; \ ln -s ${LINUX_SRCDIR}$$v/include/asm-ppc asm ; \ + + ln -s ${LINUX_SRCDIR}$$v/include/asm-sparc asm ; \ + + ln -s ${LINUX_SRCDIR}$$v/include/asm-sparc64 asm ; \ for m in ${MPS} ; do \ KDIR=${KOBJ}-$$v-$$m ; \ diff --git a/src/lwp/lwp.c b/src/lwp/lwp.c index 41d0682..7512d46 100644 --- a/src/lwp/lwp.c +++ b/src/lwp/lwp.c @@ -342,10 +342,16 @@ int LWP_CreateProcess(ep, stacksize, priority, parm, name, pid) savecontext(Create_Process_Part2, &temp2->context, stackptr+stacksize-16); /* 16 = 2 * jmp_buf_type*/ #else +#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) + savecontext(Create_Process_Part2, &temp2->context, + stackptr+stacksize-0x40); /* lomgjmp does something + with %fp + 0x38 */ +#else savecontext(Create_Process_Part2, &temp2->context, stackptr+stacksize-sizeof(void *)); #endif #endif +#endif /* End of gross hack */ Set_LWP_RC(); @@ -463,10 +469,15 @@ int LWP_DestroyProcess(pid) /* destroy a lightweight process */ savecontext(Dispatcher, &(temp -> context), &(LWPANCHOR.dsptchstack[(sizeof LWPANCHOR.dsptchstack)-8])); #else +#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) + savecontext(Dispatcher, &(temp -> context), + &(LWPANCHOR.dsptchstack[(sizeof LWPANCHOR.dsptchstack)-0x40])); +#else savecontext(Dispatcher, &(temp -> context), &(LWPANCHOR.dsptchstack[(sizeof LWPANCHOR.dsptchstack)-sizeof(void *)])); #endif #endif +#endif } return LWP_SUCCESS; } else diff --git a/src/lwp/lwp.h b/src/lwp/lwp.h index d8cb02d..e9c13eb 100644 --- a/src/lwp/lwp.h +++ b/src/lwp/lwp.h @@ -193,7 +193,7 @@ typedef struct lwp_pcb { #else struct lwp_context { /* saved context for dispatcher */ char *topstack; /* ptr to top of process stack */ -#ifdef sparc +#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 diff --git a/src/lwp/preempt.c b/src/lwp/preempt.c index 6eaba2e..3b8971c 100644 --- a/src/lwp/preempt.c +++ b/src/lwp/preempt.c @@ -95,4 +95,4 @@ int PRE_EndPreempt() return(LWP_SUCCESS); } -#endif /* AFS_I386_LINUX20_ENV */ +#endif /* AFS_LINUX20_ENV */ diff --git a/src/lwp/process.c b/src/lwp/process.c index 706752b..2618ad2 100644 --- a/src/lwp/process.c +++ b/src/lwp/process.c @@ -33,8 +33,16 @@ extern char PRE_Block; /* used in lwp.c and process.s */ #elif defined(AFS_LINUX20_ENV) #if defined(AFS_PPC_LINUX20_ENV) #define LWP_SP 0 -#else +#elif defined(AFS_I386_LINUX20_ENV) #define LWP_SP 4 +#elif defined(AFS_SPARC_LINUX20_ENV) +#define LWP_SP 0 +#define LWP_FP 1 +#elif defined(AFS_SPARC64_LINUX20_ENV) && defined(AFS_32BIT_USR_ENV) +#define LWP_SP 0 +#define LWP_FP 1 +#else +#error Unsupported linux LWP system type. #endif #else Need offset to SP in jmp_buf for this platform. @@ -97,6 +105,9 @@ char* sp; { case 0: jmpBuffer = (jmp_buf_type *)jmp_tmp; jmpBuffer[LWP_SP] = (jmp_buf_type)sp; +#if defined(AFS_SPARC_LINUX20_ENV) || (defined(AFS_SPARC64_LINUX20_ENV) && defined(AFS_32BIT_USR_ENV)) + jmpBuffer[LWP_FP] = (jmp_buf_type)sp; +#endif longjmp(jmp_tmp,1); break; case 1: (*EP)(); diff --git a/src/rx/rx.c b/src/rx/rx.c index 4768908..ace254d 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -4927,7 +4927,7 @@ void rxi_Start(event, call, istack) (char *)call, istack); #else /* RX_ENABLE_LOCKS */ call->resendEvent = rxevent_Post(&retryTime, rxi_Start, - (char *)call, (void*)istack); + (char *)call, (void*)(long)istack); #endif /* RX_ENABLE_LOCKS */ } } diff --git a/src/rx/rx_clock.h b/src/rx/rx_clock.h index 7667657..65a6663 100644 --- a/src/rx/rx_clock.h +++ b/src/rx/rx_clock.h @@ -83,7 +83,7 @@ extern void clock_UpdateTime(); #else /* KERNEL */ #include "../afs/afs_osi.h" #define clock_Init() -#if defined(AFS_SGI61_ENV) || defined(AFS_HPUX_ENV) +#if defined(AFS_SGI61_ENV) || defined(AFS_HPUX_ENV) || defined(AFS_LINUX_64BIT_KERNEL) #define clock_GetTime(cv) osi_GetTime((osi_timeval_t *)cv) #else #define clock_GetTime(cv) osi_GetTime((struct timeval *)cv) diff --git a/src/venus/fstrace.c b/src/venus/fstrace.c index 34c8157..08c9835 100644 --- a/src/venus/fstrace.c +++ b/src/venus/fstrace.c @@ -2072,11 +2072,20 @@ long call, parm0, parm1, parm2, parm3, parm4, parm5, parm6; { int code; #ifdef AFS_LINUX20_ENV +#if defined AFS_LINUX_64BIT_KERNEL + long long eparm[4]; + /* don't want to sign extend it to 64bit, so using ulong */ + eparm[0] = (unsigned long)parm3; + eparm[1] = (unsigned long)parm4; + eparm[2] = (unsigned long)parm5; + eparm[3] = (unsigned long)parm6; +#else int eparm[4]; eparm[0] = parm3; eparm[1] = parm4; eparm[2] = parm5; eparm[3] = parm6; +#endif /* Linux can only handle 5 arguments in the actual syscall. */ if (call == AFSCALL_ICL) { code = syscall(AFS_SYSCALL, call, parm0, parm1, parm2, eparm); @@ -2084,6 +2093,14 @@ long call, parm0, parm1, parm2, parm3, parm4, parm5, parm6; else { code = syscall(AFS_SYSCALL, call, parm0, parm1, parm2, parm3); } +#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_SPARC_LINUX20_ENV) + /* on sparc this function returns none value, so do it myself */ + __asm__ __volatile__ (" + mov %o0, %i0 + ret + restore +"); +#endif #else #if !defined(AFS_SGI_ENV) && !defined(AFS_AIX32_ENV) code = syscall(AFS_SYSCALL, call, parm0, parm1, parm2, parm3, parm4); diff --git a/src/venus/kdump.c b/src/venus/kdump.c index 54d4e98..880ab7e 100644 --- a/src/venus/kdump.c +++ b/src/venus/kdump.c @@ -211,6 +211,8 @@ typedef struct adaptive_mutex2 adaptive_mutex2_t; #define _LINUX_TIME_H #define _LINUX_FCNTL_H #define _I386_STATFS_H +#define _SPARC_STATFS_H +#define _SPARC64_STATFS_H struct timezone { int a,b; }; @@ -219,6 +221,7 @@ typedef struct timeval { int tv_usec; } timeval_t; /* Needed here since KERNEL defined. */ #define _LINUX_BYTEORDER_LITTLE_ENDIAN_H +#define _LINUX_BYTEORDER_BIG_ENDIAN_H #include #include #include @@ -1892,7 +1895,7 @@ int pnt; #endif } -#if defined(sparc) +#if defined(sparc) && !defined(__linux__) int readmem(kmem, buf, vad, len) int kmem, len; #ifdef AFS_SUN57_ENV @@ -1990,7 +1993,7 @@ void kread(int kmem,off_t loc,void *buf,KDUMP_SIZE_T len) } } #else -#if defined(sparc) +#if defined(sparc) && !defined(__linux__) #ifndef AFS_SUN5_ENV if (mem) { #endif @@ -2103,7 +2106,7 @@ int opencore(core) #else /* AFS_KDUMP_LIB */ int fd; -#if defined(sparc) +#if defined(sparc) && !defined(__linux__) #ifndef AFS_SUN5_ENV if (mem) { #endif diff --git a/src/volser/volmain.c b/src/volser/volmain.c index 7a5ef93..0ae13bb 100644 --- a/src/volser/volmain.c +++ b/src/volser/volmain.c @@ -163,7 +163,7 @@ void * a5; #ifndef AFS_LINUX20_ENV old = signal(SIGSYS, SIG_IGN); #endif - rcode = syscall (31 /* AFS_SYSCALL */, 28 /* AFSCALL_CALL */, a3, a4, a5); + rcode = syscall (AFS_SYSCALL /* AFS_SYSCALL */, 28 /* AFSCALL_CALL */, a3, a4, a5); #ifndef AFS_LINUX20_ENV signal(SIGSYS, old); #endif -- 1.9.4