From d7f00e40498be72c7426cf7731329fc71ce0de6f Mon Sep 17 00:00:00 2001 From: Jim Rees Date: Mon, 23 Jun 2003 18:02:17 +0000 Subject: [PATCH] i386-elf-20030623 break out i386 code from lwp/process.s to separate source file, as discussed at workshop. add support for OpenBSD 3.4, contributed by Brent Graveland (requires kernel patch for lkm; see: http://graveland.net/openbsd/openafs-on-openbsd --- src/afs/OBSD/osi_machdep.h | 4 ++ src/config/afs_sysnames.h | 1 + src/config/param.i386_obsd34.h | 62 +++++++++++++++++++ src/lwp/Makefile.in | 26 ++++---- src/lwp/process.i386.s | 99 ++++++++++++++++++++++++++++++ src/lwp/process.s | 106 --------------------------------- 6 files changed, 181 insertions(+), 117 deletions(-) create mode 100644 src/config/param.i386_obsd34.h create mode 100644 src/lwp/process.i386.s diff --git a/src/afs/OBSD/osi_machdep.h b/src/afs/OBSD/osi_machdep.h index a57c62fb0..0978ae821 100644 --- a/src/afs/OBSD/osi_machdep.h +++ b/src/afs/OBSD/osi_machdep.h @@ -82,7 +82,11 @@ extern struct timeval time; /* str */ #define afs_strcasecmp(s1, s2) strncasecmp((s1), (s2), 65535) +#ifdef AFS_OBSD34_ENV +#define strcpy(s1, s2) strncpy((s1), (s2), 65535) +#else #define afs_strcat(s1, s2) strcat((s1), (s2)) +#endif /* other */ #define afs_bufferpages bufpages diff --git a/src/config/afs_sysnames.h b/src/config/afs_sysnames.h index fd93d522c..2315f7b34 100644 --- a/src/config/afs_sysnames.h +++ b/src/config/afs_sysnames.h @@ -188,6 +188,7 @@ #define SYS_NAME_ID_i386_obsd31 2600 #define SYS_NAME_ID_i386_obsd32 2601 #define SYS_NAME_ID_i386_obsd33 2602 +#define SYS_NAME_ID_i386_obsd34 2603 #define SYS_NAME_ID_amd64_linux2 2700 #define SYS_NAME_ID_amd64_linux22 2701 diff --git a/src/config/param.i386_obsd34.h b/src/config/param.i386_obsd34.h new file mode 100644 index 000000000..0c1741209 --- /dev/null +++ b/src/config/param.i386_obsd34.h @@ -0,0 +1,62 @@ +/* + * Jim Rees, University of Michigan CITI + */ + +#ifndef AFS_PARAM_H +#define AFS_PARAM_H + +#ifndef IGNORE_STDS_H +#include +#endif + +#define SYS_NAME "i386_obsd34" +#define SYS_NAME_ID SYS_NAME_ID_i386_obsd34 + +#define AFS_XBSD_ENV 1 /* {Free,Open,Net}BSD */ +#define AFS_X86_XBSD_ENV 1 + +#define AFS_NAMEI_ENV 1 /* User space interface to file system */ +#define AFS_64BIT_ENV 1 +#define AFS_64BIT_IOPS_ENV 1 /* Needed for NAMEI */ +#define AFS_OBSD_ENV 1 +#define AFS_OBSD34_ENV 1 +#define AFS_NONFSTRANS 1 +#define AFS_KERBEROS_ENV 1 +#define AFS_VM_RDWR_ENV 1 +#define AFS_VFS_ENV 1 +#define AFS_VFSINCL_ENV 1 + +#define FTRUNC O_TRUNC + +#define AFS_SYSCALL 208 +#define AFS_MOUNT_AFS "afs" + +#define RXK_LISTENER_ENV 1 +#define AFS_GCPAGS 0 /* if nonzero, garbage collect PAGs */ +#define AFS_USE_GETTIMEOFDAY 1 /* use gettimeofday to implement rx clock */ + +#define AFSLITTLE_ENDIAN 1 + +#ifndef IGNORE_STDS_H +#include +#endif + +/* Extra kernel definitions (from kdefs file) */ +#ifdef _KERNEL +#define AFS_GLOBAL_SUNLOCK 1 +#define AFS_SHORTGID 0 /* are group id's short? */ + +#if !defined(ASSEMBLER) && !defined(__LANGUAGE_ASSEMBLY__) +enum vcexcl {NONEXCL, EXCL}; + +#ifndef MIN +#define MIN(A,B) ((A) < (B) ? (A) : (B)) +#endif +#ifndef MAX +#define MAX(A,B) ((A) > (B) ? (A) : (B)) +#endif + +#endif /* ! ASSEMBLER & ! __LANGUAGE_ASSEMBLY__ */ +#endif /* _KERNEL */ + +#endif /* AFS_PARAM_H */ diff --git a/src/lwp/Makefile.in b/src/lwp/Makefile.in index 7e3454042..fafdc97a1 100644 --- a/src/lwp/Makefile.in +++ b/src/lwp/Makefile.in @@ -47,8 +47,17 @@ process.o : process.s process.c $(RM) process.ss ;; \ ppc_darwin* ) \ $(CC) ${LWP_DBG} ${LWP_OPTMZ} -c ${XCFLAGS} -I${TOP_INCDIR} ${srcdir}/process.s;; \ - i386_fbsd*|i386_nbsd* ) \ - /usr/bin/cpp -P ${srcdir}/process.fbsd.s > process.ss; \ + i386_obsd30 | i386_obsd31 | i386_obsd32 | i386_obsd33 ) \ + cp ${srcdir}/process.i386.s process.S ; \ + ${CC} -E -I${TOP_INCDIR} process.S >process.ss ; \ + ${AS} process.ss -o process.o ; \ + $(RM) -f process.S ;;\ + i386_*bsd* ) \ + /usr/bin/cpp -P ${srcdir}/process.i386.s > process.ss; \ + ${AS} -o process.o process.ss; \ + $(RM) process.ss ;; \ + ncrx86_*) \ + /usr/ccs/lib/cpp -P -I${TOP_INCDIR} ${srcdir}/process.i386.s process.ss; \ ${AS} -o process.o process.ss; \ $(RM) process.ss ;; \ alpha_nbsd* ) \ @@ -57,20 +66,15 @@ process.o : process.s process.c $(RM) process.ss ;; \ hp* | *_linux* | *_umlinux* | sgi_64 | sgi_65 ) \ ${CC} ${CFLAGS} -c ${srcdir}/process.c;; \ - ncrx86_*) \ - /usr/ccs/lib/cpp -P -I${TOP_INCDIR} ${srcdir}/process.s process.ss; \ - ${AS} -o process.o process.ss; \ - $(RM) process.ss ;; \ alpha_osf1 | alpha_osf20 | alpha_osf30 | alpha_osf32 | alpha_osf32c | alpha_dux?? ) \ ${AS} -v -P -DOSF -I${TOP_INCDIR} -DASSEMBLER ${srcdir}/process.s; \ ${AS} -v process.i -o process.o;; \ - *_obsd* ) \ - cp ${srcdir}/process.s process.S ; \ - ${CC} -E -I${TOP_INCDIR} process.S >process.ss ; \ - ${AS} process.ss -o process.o ; \ - $(RM) -f process.S ;;\ ia64_hpux11* | hp_ux11* ) \ ${CC} ${CFLAGS} -c ${srcdir}/process.c;; \ + i386_*) \ + /lib/cpp -P -I${TOP_INCDIR} ${srcdir}/process.i386.s process.ss; \ + ${AS} process.ss -o process.o; \ + $(RM) process.ss ;; \ *) \ /lib/cpp -P -I${TOP_INCDIR} ${srcdir}/process.s process.ss; \ ${AS} process.ss -o process.o; \ diff --git a/src/lwp/process.i386.s b/src/lwp/process.i386.s new file mode 100644 index 000000000..add5b95c1 --- /dev/null +++ b/src/lwp/process.i386.s @@ -0,0 +1,99 @@ +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html + */ + +/* Sun 386i... I hope this does the right thing!!! + * + * Written by Derek Atkins + * (debugging help by Chris Provenzano ) + * 11/1991 + * + * "ojala que es correcto!" + */ + +#define IGNORE_STDS_H 1 +/*#ifndef AFS_DJGPP_ENV*/ +#include +/*#endif /* AFS_DJGPP_ENV */ + + .file "process.s" + + .data + + .text + +/* + * struct savearea { + * char *topstack; + * } + */ + + .set topstack,0 + +/* + * savecontext(f, area1, newsp) + * int (*f)(); struct savearea *area1; char *newsp; + */ + +/* offsets, to make my life easier! */ + .set f,8 + .set area1,12 + .set newsp,16 + + +#if defined(AFS_DJGPP_ENV) || (defined(AFS_OBSD_ENV) && !defined (AFS_OBSD34_ENV)) +#define PRE_Block _PRE_Block +#define savecontext _savecontext +#define abort _abort +#define returnto _returnto +#endif /* AFS_DJGPP_ENV */ + +.globl PRE_Block +.globl savecontext + + savecontext: + pushl %ebp /* New Frame! */ + movl %esp,%ebp + pusha /* Push all registers */ + movl $1,PRE_Block /* Pre-emption code */ + movl area1(%ebp),%eax /* eax = base of savearea */ + movl %esp,(%eax) /* area->topstack = esp */ + movl newsp(%ebp),%eax /* get new sp into eax */ + cmpl $0,%eax + je L1 /* if new sp is 0 then dont change esp */ + movl %eax,%esp /* go ahead. make my day! */ +L1: + jmp *f(%ebp) /* ebx = &f */ + +/* Shouldnt be here....*/ + + call abort + +/* + * returnto(area2) + * struct savearea *area2; + */ + +/* stack offset */ + .set area2,8 + +.globl returnto + +returnto: + pushl %ebp + movl %esp, %ebp /* New frame, to get correct pointer */ + movl area2(%ebp),%eax /* eax = area2 */ + movl (%eax),%esp /* restore esp */ + popa + movl $0,PRE_Block /* clear it up... */ + popl %ebp + ret + +/* I see, said the blind man, as he picked up his hammer and saw! */ + pushl $1234 + call abort diff --git a/src/lwp/process.s b/src/lwp/process.s index 1f355c94e..223f2156c 100644 --- a/src/lwp/process.s +++ b/src/lwp/process.s @@ -1165,112 +1165,6 @@ LEAF(returnto,1) END(returnto) #endif -#if defined(AFS_NCR_ENV) || defined(AFS_X86_ENV) || defined(AFS_DJGPP_ENV) || defined(AFS_OBSD_ENV) -/* Sun 386i... I hope this does the right thing!!! - * - * Written by Derek Atkins - * (debugging help by Chris Provenzano ) - * 11/1991 - * - * "ojala que es correcto!" - */ - .file "process.s" - - .data - - .text - -/* - * struct savearea { - * char *topstack; - * } - */ - - .set topstack,0 - -/* - * savecontext(f, area1, newsp) - * int (*f)(); struct savearea *area1; char *newsp; - */ - -/* offsets, to make my life easier! */ - .set f,8 - .set area1,12 - .set newsp,16 - - -#if defined(AFS_DJGPP_ENV) || defined(AFS_XBSD_ENV) -.globl _PRE_Block -.globl _savecontext -_savecontext: -#else -.globl PRE_Block -.globl savecontext -savecontext: -#endif /* AFS_DJGPP_ENV */ - pushl %ebp /* New Frame! */ - movl %esp,%ebp - pusha /* Push all registers */ -#if defined(AFS_DJGPP_ENV) || defined(AFS_XBSD_ENV) - movl $1,_PRE_Block /* Pre-emption code */ -#else - movl $1,PRE_Block /* Pre-emption code */ -#endif /* AFS_DJGPP_ENV */ - movl area1(%ebp),%eax /* eax = base of savearea */ - movl %esp,(%eax) /* area->topstack = esp */ - movl newsp(%ebp),%eax /* get new sp into eax */ - cmpl $0,%eax - je L1 /* if new sp is 0 then dont change esp */ - movl %eax,%esp /* go ahead. make my day! */ -L1: - jmp *f(%ebp) /* ebx = &f */ - -/* Shouldnt be here....*/ - -#if defined(AFS_DJGPP_ENV) || defined(AFS_XBSD_ENV) - call _abort -#else - call abort -#endif /* AFS_DJGPP_ENV */ - -/* - * returnto(area2) - * struct savearea *area2; - */ - -/* stack offset */ - .set area2,8 - -#if defined(AFS_DJGPP_ENV) || defined(AFS_XBSD_ENV) -.globl _returnto -_returnto: -#else -.globl returnto -returnto: -#endif /* AFS_DJGPP_ENV */ - pushl %ebp - movl %esp, %ebp /* New frame, to get correct pointer */ - movl area2(%ebp),%eax /* eax = area2 */ - movl (%eax),%esp /* restore esp */ - popa -#if defined(AFS_DJGPP_ENV) || defined(AFS_XBSD_ENV) - movl $0,_PRE_Block /* clear it up... */ -#else - movl $0,PRE_Block /* clear it up... */ -#endif /* AFS_DJGPP_ENV */ - popl %ebp - ret - -/* I see, said the blind man, as he picked up his hammer and saw! */ - pushl $1234 -#if defined(AFS_DJGPP_ENV) || defined(AFS_XBSD_ENV) - call _abort -#else - call abort -#endif /* AFS_DJGPP_ENV */ - - -#endif /* AFS_NCR_ENV */ #ifdef AFS_PPC_ENV /* Comments: * 1. Registers R10..R31 and CR0..CR7 are saved -- 2.39.5