From: Jan-Benedict G. <jb...@us...> - 2005-04-26 22:53:44
|
Update of /cvsroot/linux-vax/kernel-2.5/include/asm-vax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6417 Modified Files: a.out.h atomic.h Log Message: - Ready for upstream merge:) Index: a.out.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/include/asm-vax/a.out.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- a.out.h 20 May 2002 00:33:38 -0000 1.3 +++ a.out.h 26 Apr 2005 22:53:31 -0000 1.4 @@ -1,30 +1,35 @@ -#ifndef _VAX_A_OUT_H_ -#define _VAX_A_OUT_H_ +#ifndef _VAX_A_OUT_H +#define _VAX_A_OUT_H -/* from the i386 port */ -#define STACK_TOP TASK_SIZE /* 0x7fffffff */ /*was TASK_SIZE and is TASK_SIZE once again .. - D.A. June 2001.. otherwise argc stuff breaks */ +/* Stolen from the i386 port */ -/* this is needed to override a conflicting definition in ../linux/a.out.h */ -#define page_size PAGE_SIZE -/* it should be : -#define SEGMENT_SIZE PAGE_SIZE -*/ -struct exec -{ - unsigned long a_info; /* Use macros N_MAGIC, etc for access */ - unsigned a_text; /* length of text, in bytes */ - unsigned a_data; /* length of data, in bytes */ - unsigned a_bss; /* length of uninitialized data area for file, in bytes */ - unsigned a_syms; /* length of symbol table data in file, in bytes */ - unsigned a_entry; /* start address */ - unsigned a_trsize; /* length of relocation info for text, in bytes */ - unsigned a_drsize; /* length of relocation info for data, in bytes */ -}; +/* + * This was TASK_SIZE and is TASK_SIZE once again. Don't play + * games with it, otherwise argc stuff breaks. + */ +#define STACK_TOP TASK_SIZE /* = 0x7fffffff */ + +/* + * This is needed to override a conflicting definition in ../linux/a.out.h + * It should really be: + * + * #define SEGMENT_SIZE PAGE_SIZE + */ +#define page_size PAGE_SIZE +struct exec { + unsigned long a_info; /* Use macros N_MAGIC, etc for access */ + unsigned a_text; /* length of text, in bytes */ + unsigned a_data; /* length of data, in bytes */ + unsigned a_bss; /* length of uninitialized data area for file, in bytes */ + unsigned a_syms; /* length of symbol table data in file, in bytes */ + unsigned a_entry; /* start address */ + unsigned a_trsize; /* length of relocation info for text, in bytes */ + unsigned a_drsize; /* length of relocation info for data, in bytes */ +}; #define N_TRSIZE(a) ((a).a_trsize) #define N_DRSIZE(a) ((a).a_drsize) #define N_SYMSIZE(a) ((a).a_syms) - -#endif /* _VAX_A_OUT_H_ */ +#endif /* _VAX_A_OUT_H */ Index: atomic.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/include/asm-vax/atomic.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- atomic.h 20 May 2002 00:33:38 -0000 1.3 +++ atomic.h 26 Apr 2005 22:53:31 -0000 1.4 @@ -1,5 +1,5 @@ -#ifndef _ARCH_VAX_ATOMIC -#define _ARCH_VAX_ATOMIC +#ifndef _VAX_ATOMIC_H +#define _VAX_ATOMIC_H #include <linux/config.h> @@ -10,12 +10,16 @@ /* * Worry about SMP VAXes later. Much later... - * Still, should try and use interlocked instructions here. - * When we do, we'll have to make atomic_t a short int, since - * ADAWI only works on WORDs and that's the only interlocked - * arithmetic primitive we have + * + * Still, should try and use interlocked instructions here. + * When we do, we'll have to make atomic_t a short int, since + * ADAWI only works on WORDs and that's the only interlocked + * arithmetic primitive we have. */ +#ifdef CONFIG_SMP +#error "SMP configuration aren't supported right now..." +#endif typedef struct { volatile int counter; } atomic_t; @@ -24,137 +28,145 @@ /** * atomic_read - read atomic variable * @v: pointer of type atomic_t - * + * * Atomically reads the value of @v. Note that the guaranteed * useful range of an atomic_t is only 24 bits. - */ + */ #define atomic_read(v) ((v)->counter) /** * atomic_set - set atomic variable * @v: pointer of type atomic_t * @i: required value - * + * * Atomically sets the value of @v to @i. Note that the guaranteed * useful range of an atomic_t is only 24 bits. - */ + */ #define atomic_set(v, i) (((v)->counter) = i) /** * atomic_add - add integer to atomic variable * @i: integer value to add * @v: pointer of type atomic_t - * + * * Atomically adds @i to @v. Note that the guaranteed useful range * of an atomic_t is only 24 bits -- Not sure thats true on the vax. */ static __inline__ void atomic_add(int i, atomic_t *v) { __asm__ __volatile__( - "addl2 %1,%0" - : "=m" (v->counter) - : "g" (i), "m" (v->counter)); + " addl2 %1, %0 \n" + : "=m" (v->counter) + : "g" (i), + "m" (v->counter)); } /** * atomic_sub - subtract the atomic variable * @i: integer value to subtract * @v: pointer of type atomic_t - * + * * Atomically subtracts @i from @v. Note that the guaranteed - * useful range of an atomic_t is only 24 bits. Not sure thats + * useful range of an atomic_t is only 24 bits. Not sure thats * true for VAX. */ static __inline__ void atomic_sub(int i, atomic_t *v) { __asm__ __volatile__( - "subl2 %1,%0" - :"=m" (v->counter) - :"g" (i), "m" (v->counter)); + " subl2 %1, %0 \n" + : "=m" (v->counter) + : "g" (i), + "m" (v->counter)); } /** * atomic_sub_and_test - subtract value from variable and test result * @i: integer value to subtract * @v: pointer of type atomic_t - * + * * Atomically subtracts @i from @v and returns * true if the result is zero, or false for all * other cases. Note that the guaranteed * useful range of an atomic_t is only 24 bits. */ -#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0) +#define atomic_sub_and_test(i, v) (atomic_sub_return((i), (v)) == 0) /** * atomic_inc - increment atomic variable * @v: pointer of type atomic_t - * + * * Atomically increments @v by 1. Note that the guaranteed * useful range of an atomic_t is only 24 bits. (i386) Not sure * thats true on a VAX. - */ + */ static __inline__ void atomic_inc(atomic_t *v) { __asm__ __volatile__( - "incl %0" - : "=m" (v->counter) - : "m" (v->counter)); + " incl %0 \n" + : "=m" (v->counter) + : "m" (v->counter)); } /** * atomic_dec - decrement atomic variable * @v: pointer of type atomic_t - * + * * Atomically decrements @v by 1. Note that the guaranteed * useful range of an atomic_t is only 24 bits. - */ - + */ static __inline__ void atomic_dec(volatile atomic_t *v) { __asm__ __volatile__( - "decl %0" - : "=m" (v->counter) - : "m" (v->counter)); + " decl %0 \n" + : "=m" (v->counter) + : "m" (v->counter)); } /** * atomic_dec_and_test - decrement and test * @v: pointer of type atomic_t - * + * * Atomically decrements @v by 1 and * returns true if the result is 0, or false for all other * cases. Note that the guaranteed * useful range of an atomic_t is only 24 bits. - */ + */ static __inline__ int atomic_dec_and_test(volatile atomic_t *v) { unsigned long c; - + __asm__ __volatile__( - "decl %0; movl %0, %1" - : "=m" (v->counter), "=g" (c) - : "m" (v->counter): "memory"); + " decl %0 \n" + " movl %0, %1 \n" + : "=m" (v->counter), + "=g" (c) + : "m" (v->counter) + : "memory"); + return (c == 0); } - /** - * atomic_inc_and_test - increment and test + * atomic_inc_and_test - increment and test * @v: pointer of type atomic_t - * + * * Atomically increments @v by 1 * and returns true if the result is zero, or false for all * other cases. Note that the guaranteed * useful range of an atomic_t is only 24 bits. - */ + */ static __inline__ int atomic_inc_and_test(atomic_t *v) { unsigned long c; __asm__ __volatile__( - "incl %0; movl %0, %1" - :"=m" (v->counter), "=g" (c) - :"m" (v->counter) : "memory"); + " incl %0 \n" + " movl %0, %1 \n" + : "=m" (v->counter), + "=g" (c) + : "m" (v->counter) + : "memory"); + return (c == 0); } @@ -162,12 +174,12 @@ * atomic_add_negative - add and test if negative * @v: pointer of type atomic_t * @i: integer value to add - * + * * Atomically adds @i to @v and returns true * if the result is negative, or false when * result is greater than or equal to zero. Note that the guaranteed * useful range of an atomic_t is only 24 bits. - */ + */ static __inline__ int atomic_add_negative(int i, atomic_t *v) { int retval = 0; @@ -181,7 +193,10 @@ return retval; } -/* These are x86-specific, used by some header files + + +/* + * These are x86-specific, used by some header files * But we may find a use for them too. */ #define atomic_clear_mask(mask, v) \ @@ -196,36 +211,45 @@ #define smp_mb__after_atomic_inc() smp_mb() -/* +/* * These functions are used in semaphore.h */ -static __inline__ long atomic_add_return(int i, atomic_t * v) +static __inline__ long atomic_add_return(int i, atomic_t *v) { - long temp, result; - __asm__ __volatile__( - "1: movl %1, %0\n" - " addl2 %3,%0\n" - " movl %0,%2\n" - " movl %0,%1\n" - :"=&r" (temp), "=m" (v->counter), "=&r" (result) - :"Ir" (i), "m" (v->counter)); - return result; + long temp, result; + + __asm__ __volatile__( + "1: movl %1, %0 \n" + " addl2 %3, %0 \n" + " movl %0, %2 \n" + " movl %0, %1 \n" + : "=&r" (temp), + "=m" (v->counter), + "=&r" (result) + : "Ir" (i), + "m" (v->counter)); + + return result; } -static __inline__ long atomic_sub_return(int i, atomic_t * v) +static __inline__ long atomic_sub_return(int i, atomic_t *v) { - long temp, result; - __asm__ __volatile__( - "1: movl %1, %0\n" - " subl2 %3,%0\n" - " movl %0,%2\n" - " movl %0,%1\n" - :"=&r" (temp), "=m" (v->counter), "=&r" (result) - :"Ir" (i), "m" (v->counter)); - return result; + long temp, result; + __asm__ __volatile__( + "1: movl %1, %0 \n" + " subl2 %3, %0 \n" + " movl %0, %2 \n" + " movl %0, %1 \n" + : "=&r" (temp), + "=m" (v->counter), + "=&r" (result) + : "Ir" (i), + "m" (v->counter)); + + return result; } -#define atomic_dec_return(v) atomic_sub_return(1,(v)) -#define atomic_inc_return(v) atomic_add_return(1,(v)) +#define atomic_dec_return(v) atomic_sub_return(1,(v)) +#define atomic_inc_return(v) atomic_add_return(1,(v)) -#endif /* _ARCH_VAX_ATOMIC*/ +#endif /* _VAX_ATOMIC_H */ |