From 967c65a99059fd459b956c1588ce0ba227912c4e Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Tue, 16 Dec 1997 05:34:03 +0000 Subject: Merge with Linux 2.1.72, part 1. --- include/asm-i386/atomic.h | 2 +- include/asm-i386/bitops.h | 19 +++++- include/asm-i386/byteorder.h | 141 +++++----------------------------------- include/asm-i386/delay.h | 2 +- include/asm-i386/io.h | 8 +-- include/asm-i386/ioctls.h | 1 + include/asm-i386/irq.h | 3 - include/asm-i386/posix_types.h | 1 + include/asm-i386/processor.h | 19 ++++-- include/asm-i386/segment.h | 8 +-- include/asm-i386/sigcontext.h | 1 + include/asm-i386/signal.h | 143 +++++++++++++++++++++++++++++++++++------ include/asm-i386/system.h | 12 ++-- include/asm-i386/uaccess.h | 22 +++---- include/asm-i386/unistd.h | 9 +++ 15 files changed, 208 insertions(+), 183 deletions(-) (limited to 'include/asm-i386') diff --git a/include/asm-i386/atomic.h b/include/asm-i386/atomic.h index 5690c46e2..fd1d75beb 100644 --- a/include/asm-i386/atomic.h +++ b/include/asm-i386/atomic.h @@ -17,7 +17,7 @@ * on us. We need to use _exactly_ the address the user gave us, * not some alias that contains the same information. */ -#define __atomic_fool_gcc(x) (*(struct { int a[100]; } *)x) +#define __atomic_fool_gcc(x) (*(volatile struct { int a[100]; } *)x) #ifdef __SMP__ typedef struct { volatile int counter; } atomic_t; diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h index ee24aa79f..3b31d4f57 100644 --- a/include/asm-i386/bitops.h +++ b/include/asm-i386/bitops.h @@ -19,12 +19,27 @@ #define LOCK_PREFIX "" #endif +/* + * Function prototypes to keep gcc -Wall happy + */ +extern void set_bit(int nr, volatile void * addr); +extern void clear_bit(int nr, volatile void * addr); +extern void change_bit(int nr, volatile void * addr); +extern int test_and_set_bit(int nr, volatile void * addr); +extern int test_and_clear_bit(int nr, volatile void * addr); +extern int test_and_change_bit(int nr, volatile void * addr); +extern int __constant_test_bit(int nr, const volatile void * addr); +extern int __test_bit(int nr, volatile void * addr); +extern int find_first_zero_bit(void * addr, unsigned size); +extern int find_next_zero_bit (void * addr, int size, int offset); +extern unsigned long ffz(unsigned long word); + /* * Some hacks to defeat gcc over-optimizations.. */ struct __dummy { unsigned long a[100]; }; -#define ADDR (*(struct __dummy *) addr) -#define CONST_ADDR (*(const struct __dummy *) addr) +#define ADDR (*(volatile struct __dummy *) addr) +#define CONST_ADDR (*(volatile const struct __dummy *) addr) extern __inline__ void set_bit(int nr, volatile void * addr) { diff --git a/include/asm-i386/byteorder.h b/include/asm-i386/byteorder.h index ef55ae3ca..51d66f8fc 100644 --- a/include/asm-i386/byteorder.h +++ b/include/asm-i386/byteorder.h @@ -1,36 +1,16 @@ #ifndef _I386_BYTEORDER_H #define _I386_BYTEORDER_H -#undef ntohl -#undef ntohs -#undef htonl -#undef htons +#include -#ifndef __LITTLE_ENDIAN -#define __LITTLE_ENDIAN 1234 -#endif - -#ifndef __LITTLE_ENDIAN_BITFIELD -#define __LITTLE_ENDIAN_BITFIELD -#endif +#ifdef __GNUC__ /* For avoiding bswap on i386 */ #ifdef __KERNEL__ #include #endif -extern unsigned long int ntohl(unsigned long int); -extern unsigned short int ntohs(unsigned short int); -extern unsigned long int htonl(unsigned long int); -extern unsigned short int htons(unsigned short int); - -extern __inline__ unsigned long int __ntohl(unsigned long int); -extern __inline__ unsigned short int __ntohs(unsigned short int); -extern __inline__ unsigned long int __constant_ntohl(unsigned long int); -extern __inline__ unsigned short int __constant_ntohs(unsigned short int); - -extern __inline__ unsigned long int -__ntohl(unsigned long int x) +static __inline__ __const__ __u32 ___arch__swab32(__u32 x) { #if defined(__KERNEL__) && !defined(CONFIG_M386) __asm__("bswap %0" : "=r" (x) : "0" (x)); @@ -40,115 +20,28 @@ __ntohl(unsigned long int x) "xchgb %b0,%h0" /* swap higher bytes */ :"=q" (x) : "0" (x)); -#endif +#endif return x; } -#define __constant_ntohl(x) \ - ((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \ - (((unsigned long int)(x) & 0x0000ff00U) << 8) | \ - (((unsigned long int)(x) & 0x00ff0000U) >> 8) | \ - (((unsigned long int)(x) & 0xff000000U) >> 24))) - -extern __inline__ unsigned short int -__ntohs(unsigned short int x) +static __inline__ __const__ __u16 ___arch__swab16(__u16 x) { - __asm__("xchgb %b0,%h0" /* swap bytes */ - : "=q" (x) - : "0" (x)); - return x; + __asm__("xchgb %b0,%h0" /* swap bytes */ \ + : "=q" (x) \ + : "0" (x)); \ + return x; } -#define __constant_ntohs(x) \ - ((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \ - (((unsigned short int)(x) & 0xff00) >> 8))) \ - -#define __htonl(x) __ntohl(x) -#define __htons(x) __ntohs(x) -#define __constant_htonl(x) __constant_ntohl(x) -#define __constant_htons(x) __constant_ntohs(x) +#define __arch__swab32(x) ___arch__swab32(x) +#define __arch__swab16(x) ___arch__swab16(x) -#ifdef __OPTIMIZE__ -# define ntohl(x) \ -(__builtin_constant_p((long)(x)) ? \ - __constant_ntohl((x)) : \ - __ntohl((x))) -# define ntohs(x) \ -(__builtin_constant_p((short)(x)) ? \ - __constant_ntohs((x)) : \ - __ntohs((x))) -# define htonl(x) \ -(__builtin_constant_p((long)(x)) ? \ - __constant_htonl((x)) : \ - __htonl((x))) -# define htons(x) \ -(__builtin_constant_p((short)(x)) ? \ - __constant_htons((x)) : \ - __htons((x))) +#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) +# define __BYTEORDER_HAS_U64__ +# define __SWAB_64_THRU_32__ #endif -#ifdef __KERNEL__ -/* - * In-kernel byte order macros to handle stuff like - * byte-order-dependent filesystems etc. - */ -#define cpu_to_le32(x) (x) -#define cpu_to_le16(x) (x) - -#define cpu_to_be32(x) htonl((x)) -#define cpu_to_be16(x) htons((x)) - -/* The same, but returns converted value from the location pointer by addr. */ -extern __inline__ __u16 cpu_to_le16p(__u16 *addr) -{ - return cpu_to_le16(*addr); -} - -extern __inline__ __u32 cpu_to_le32p(__u32 *addr) -{ - return cpu_to_le32(*addr); -} - -extern __inline__ __u16 cpu_to_be16p(__u16 *addr) -{ - return cpu_to_be16(*addr); -} +#endif /* __GNUC__ */ -extern __inline__ __u32 cpu_to_be32p(__u32 *addr) -{ - return cpu_to_be32(*addr); -} - -/* The same, but do the conversion in situ, ie. put the value back to addr. */ -#define cpu_to_le16s(x) do { } while (0) -#define cpu_to_le32s(x) do { } while (0) - -extern __inline__ void cpu_to_be16s(__u16 *addr) -{ - *addr = cpu_to_be16(*addr); -} +#include -extern __inline__ void cpu_to_be32s(__u32 *addr) -{ - *addr = cpu_to_be32(*addr); -} - -/* Convert from specified byte order, to CPU byte order. */ -#define le16_to_cpu(x) cpu_to_le16(x) -#define le32_to_cpu(x) cpu_to_le32(x) -#define be16_to_cpu(x) cpu_to_be16(x) -#define be32_to_cpu(x) cpu_to_be32(x) - -#define le16_to_cpup(x) cpu_to_le16p(x) -#define le32_to_cpup(x) cpu_to_le32p(x) -#define be16_to_cpup(x) cpu_to_be16p(x) -#define be32_to_cpup(x) cpu_to_be32p(x) - -#define le16_to_cpus(x) cpu_to_le16s(x) -#define le32_to_cpus(x) cpu_to_le32s(x) -#define be16_to_cpus(x) cpu_to_be16s(x) -#define be32_to_cpus(x) cpu_to_be32s(x) - -#endif /* __KERNEL__ */ - -#endif +#endif /* _I386_BYTEORDER_H */ diff --git a/include/asm-i386/delay.h b/include/asm-i386/delay.h index ebd9f9d93..2166c4c6d 100644 --- a/include/asm-i386/delay.h +++ b/include/asm-i386/delay.h @@ -12,7 +12,7 @@ extern void __const_udelay(unsigned long usecs); extern void __delay(unsigned long loops); #define udelay(n) (__builtin_constant_p(n) ? \ - __const_udelay((n) * 0x10c6) : \ + __const_udelay((n) * 0x10c6ul) : \ __udelay(n)) #endif /* defined(_I386_DELAY_H) */ diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h index 0d611cef4..155ff1419 100644 --- a/include/asm-i386/io.h +++ b/include/asm-i386/io.h @@ -36,9 +36,9 @@ #endif #ifdef REALLY_SLOW_IO -#define SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO +#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO #else -#define SLOW_DOWN_IO __SLOW_DOWN_IO +#define __FULL_SLOW_DOWN_IO __SLOW_DOWN_IO #endif /* @@ -52,7 +52,7 @@ __asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1" #define __OUT(s,s1,x) \ __OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "Nd" (port)); } \ -__OUT1(s##_p,x) __OUT2(s,s1,"w") SLOW_DOWN_IO : : "a" (value), "Nd" (port));} \ +__OUT1(s##_p,x) __OUT2(s,s1,"w") __FULL_SLOW_DOWN_IO : : "a" (value), "Nd" (port));} \ #define __IN1(s) \ extern inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v; @@ -62,7 +62,7 @@ __asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0" #define __IN(s,s1,i...) \ __IN1(s) __IN2(s,s1,"w") : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \ -__IN1(s##_p) __IN2(s,s1,"w") SLOW_DOWN_IO : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \ +__IN1(s##_p) __IN2(s,s1,"w") __FULL_SLOW_DOWN_IO : "=a" (_v) : "Nd" (port) ,##i ); return _v; } \ #define __INS(s) \ extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \ diff --git a/include/asm-i386/ioctls.h b/include/asm-i386/ioctls.h index ae04e1a55..7930defbe 100644 --- a/include/asm-i386/ioctls.h +++ b/include/asm-i386/ioctls.h @@ -46,6 +46,7 @@ #define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ #define TIOCSBRK 0x5427 /* BSD compatibility */ #define TIOCCBRK 0x5428 /* BSD compatibility */ +#define TIOCGSID 0x5429 /* Return the session ID of FD */ #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ #define FIOCLEX 0x5451 diff --git a/include/asm-i386/irq.h b/include/asm-i386/irq.h index d764ef164..b96288a5c 100644 --- a/include/asm-i386/irq.h +++ b/include/asm-i386/irq.h @@ -9,9 +9,6 @@ * IRQ/IPI changes taken from work by Thomas Radke */ -#include -#include - #define NR_IRQS 16 #define TIMER_IRQ 0 diff --git a/include/asm-i386/posix_types.h b/include/asm-i386/posix_types.h index 4da54d2be..aed0fd6fd 100644 --- a/include/asm-i386/posix_types.h +++ b/include/asm-i386/posix_types.h @@ -20,6 +20,7 @@ typedef unsigned int __kernel_size_t; typedef int __kernel_ssize_t; typedef int __kernel_ptrdiff_t; typedef long __kernel_time_t; +typedef long __kernel_suseconds_t; typedef long __kernel_clock_t; typedef int __kernel_daddr_t; typedef char * __kernel_caddr_t; diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index b4f26c73c..449caf768 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h @@ -9,6 +9,7 @@ #include #include +#include /* * System setup and hardware bug flags.. @@ -87,6 +88,10 @@ union i387_union { struct i387_soft_struct soft; }; +typedef struct { + unsigned long seg; +} mm_segment_t; + struct thread_struct { unsigned short back_link,__blh; unsigned long esp0; @@ -113,7 +118,8 @@ struct thread_struct { unsigned short trace, bitmap; unsigned long io_bitmap[IO_BITMAP_SIZE+1]; unsigned long tr; - unsigned long cr2, trap_no, error_code, segment; + unsigned long cr2, trap_no, error_code; + mm_segment_t segment; /* floating point info */ union i387_union i387; /* virtual 86 mode info */ @@ -128,11 +134,12 @@ struct thread_struct { #define INIT_TSS { \ 0,0, \ sizeof(init_stack) + (long) &init_stack, \ - KERNEL_DS, 0, \ + __KERNEL_DS, 0, \ 0,0,0,0,0,0, \ (long) &swapper_pg_dir - PAGE_OFFSET, \ 0,0,0,0,0,0,0,0,0,0, \ - USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0,USER_DS,0, \ + __USER_DS,0,__USER_DS,0,__USER_DS,0, \ + __USER_DS,0,__USER_DS,0,__USER_DS,0, \ _LDT(0),0, \ 0, 0x8000, \ {~0, }, /* ioperm */ \ @@ -142,13 +149,13 @@ struct thread_struct { } #define start_thread(regs, new_eip, new_esp) do {\ - unsigned long seg = USER_DS; \ + unsigned long seg = __USER_DS; \ __asm__("mov %w0,%%fs ; mov %w0,%%gs":"=r" (seg) :"0" (seg)); \ - set_fs(seg); \ + set_fs(MAKE_MM_SEG(seg)); \ regs->xds = seg; \ regs->xes = seg; \ regs->xss = seg; \ - regs->xcs = USER_CS; \ + regs->xcs = __USER_CS; \ regs->eip = new_eip; \ regs->esp = new_esp; \ } while (0) diff --git a/include/asm-i386/segment.h b/include/asm-i386/segment.h index d5f1ef6de..f09db9f73 100644 --- a/include/asm-i386/segment.h +++ b/include/asm-i386/segment.h @@ -1,10 +1,10 @@ #ifndef _ASM_SEGMENT_H #define _ASM_SEGMENT_H -#define KERNEL_CS 0x10 -#define KERNEL_DS 0x18 +#define __KERNEL_CS 0x10 +#define __KERNEL_DS 0x18 -#define USER_CS 0x23 -#define USER_DS 0x2B +#define __USER_CS 0x23 +#define __USER_DS 0x2B #endif diff --git a/include/asm-i386/sigcontext.h b/include/asm-i386/sigcontext.h index 3d8f51ea4..616fb1415 100644 --- a/include/asm-i386/sigcontext.h +++ b/include/asm-i386/sigcontext.h @@ -51,4 +51,5 @@ struct sigcontext { unsigned long cr2; }; + #endif diff --git a/include/asm-i386/signal.h b/include/asm-i386/signal.h index c68928cd7..5da9ff0ed 100644 --- a/include/asm-i386/signal.h +++ b/include/asm-i386/signal.h @@ -1,10 +1,32 @@ #ifndef _ASMi386_SIGNAL_H #define _ASMi386_SIGNAL_H -typedef unsigned long sigset_t; /* at least 32 bits */ +#include -#define _NSIG 32 -#define NSIG _NSIG +/* Avoid too many header ordering problems. */ +struct siginfo; + +#ifdef __KERNEL__ +/* Most things should be clean enough to redefine this at will, if care + is taken to make libc match. */ + +#define _NSIG 64 +#define _NSIG_BPW 32 +#define _NSIG_WORDS (_NSIG / _NSIG_BPW) + +typedef unsigned long old_sigset_t; /* at least 32 bits */ + +typedef struct { + unsigned long sig[_NSIG_WORDS]; +} sigset_t; + +#else +/* Here we must cater to libcs that poke about in kernel headers. */ + +#define NSIG 32 +typedef unsigned long sigset_t; + +#endif /* __KERNEL__ */ #define SIGHUP 1 #define SIGINT 2 @@ -43,35 +65,52 @@ typedef unsigned long sigset_t; /* at least 32 bits */ #define SIGPWR 30 #define SIGUNUSED 31 +/* These should not be considered constants from userland. */ +#define SIGRTMIN 32 +#define SIGRTMAX (_NSIG-1) + /* - * sa_flags values: SA_STACK is not currently supported, but will allow the - * usage of signal stacks by using the (now obsolete) sa_restorer field in - * the sigaction structure as a stack pointer. This is now possible due to - * the changes in signal handling. LBT 010493. + * SA_FLAGS values: + * + * SA_ONSTACK is not currently supported, but will allow sigaltstack(2). * SA_INTERRUPT is a no-op, but left due to historical reasons. Use the * SA_RESTART flag to get restarting signals (which were the default long ago) - * SA_SHIRQ flag is for shared interrupt support on PCI and EISA. + * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. + * SA_RESETHAND clears the handler when the signal is delivered. + * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. + * SA_NODEFER prevents the current signal from being masked in the handler. + * + * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single + * Unix names RESETHAND and NODEFER respectively. */ -#define SA_NOCLDSTOP 1 -#define SA_SHIRQ 0x04000000 -#define SA_STACK 0x08000000 +#define SA_NOCLDSTOP 0x00000001 +#define SA_NOCLDWAIT 0x00000002 /* not supported yet */ +#define SA_SIGINFO 0x00000004 +#define SA_ONSTACK 0x08000000 #define SA_RESTART 0x10000000 -#define SA_INTERRUPT 0x20000000 -#define SA_NOMASK 0x40000000 -#define SA_ONESHOT 0x80000000 +#define SA_NODEFER 0x40000000 +#define SA_RESETHAND 0x80000000 + +#define SA_NOMASK SA_NODEFER +#define SA_ONESHOT SA_RESETHAND +#define SA_INTERRUPT 0x20000000 /* dummy -- ignored */ + +#define SA_RESTORER 0x04000000 #ifdef __KERNEL__ + /* * These values of sa_flags are used only by the kernel as part of the * irq handling routines. * * SA_INTERRUPT is also used by the irq handling routines. + * SA_SHIRQ is for shared interrupt support on PCI and EISA. */ -#define SA_PROBE SA_ONESHOT -#define SA_SAMPLE_RANDOM SA_RESTART +#define SA_PROBE SA_ONESHOT +#define SA_SAMPLE_RANDOM SA_RESTART +#define SA_SHIRQ 0x04000000 #endif - #define SIG_BLOCK 0 /* for blocking signals */ #define SIG_UNBLOCK 1 /* for unblocking signals */ #define SIG_SETMASK 2 /* for setting the signal mask */ @@ -83,15 +122,83 @@ typedef void (*__sighandler_t)(int); #define SIG_IGN ((__sighandler_t)1) /* ignore signal */ #define SIG_ERR ((__sighandler_t)-1) /* error return from signal */ +#ifdef __KERNEL__ +struct old_sigaction { + __sighandler_t sa_handler; + old_sigset_t sa_mask; + unsigned long sa_flags; + void (*sa_restorer)(void); +}; + +struct sigaction { + __sighandler_t sa_handler; + unsigned long sa_flags; + void (*sa_restorer)(void); + sigset_t sa_mask; /* mask last for extensibility */ +}; + +struct k_sigaction { + struct sigaction sa; +}; +#else +/* Here we must cater to libcs that poke about in kernel headers. */ + struct sigaction { __sighandler_t sa_handler; sigset_t sa_mask; unsigned long sa_flags; void (*sa_restorer)(void); }; +#endif /* __KERNEL__ */ + +typedef struct sigaltstack { + void *ss_sp; + int ss_flags; + size_t ss_size; +} stack_t; #ifdef __KERNEL__ #include -#endif + +#define __HAVE_ARCH_SIG_BITOPS + +extern __inline__ void sigaddset(sigset_t *set, int _sig) +{ + __asm__("btsl %1,%0" : "=m"(*set) : "ir"(_sig - 1) : "cc"); +} + +extern __inline__ void sigdelset(sigset_t *set, int _sig) +{ + __asm__("btrl %1,%0" : "=m"(*set) : "ir"(_sig - 1) : "cc"); +} + +extern __inline__ int __const_sigismember(sigset_t *set, int _sig) +{ + unsigned long sig = _sig - 1; + return 1 & (set->sig[sig / _NSIG_BPW] >> (sig % _NSIG_BPW)); +} + +extern __inline__ int __gen_sigismember(sigset_t *set, int _sig) +{ + int ret; + __asm__("btl %2,%1\n\tsbbl %0,%0" + : "=r"(ret) : "m"(*set), "ir"(_sig-1) : "cc"); + return ret; +} + +#define sigismember(set,sig) \ + (__builtin_constant_p(sig) ? \ + __const_sigismember((set),(sig)) : \ + __gen_sigismember((set),(sig))) + +#define sigmask(sig) (1UL << ((sig) - 1)) + +extern __inline__ int sigfindinword(unsigned long word) +{ + __asm__("bsfl %1,%0" : "=r"(word) : "rm"(word) : "cc"); + return word; +} + +#endif /* __KERNEL__ */ #endif diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h index 9dcc21b44..145118a71 100644 --- a/include/asm-i386/system.h +++ b/include/asm-i386/system.h @@ -21,8 +21,8 @@ #define FIRST_LDT_ENTRY (FIRST_TSS_ENTRY+1) #define _TSS(n) ((((unsigned long) n)<<4)+(FIRST_TSS_ENTRY<<3)) #define _LDT(n) ((((unsigned long) n)<<4)+(FIRST_LDT_ENTRY<<3)) -#define load_TR(n) __asm__("ltr %%ax": /* no output */ :"a" (_TSS(n))) -#define load_ldt(n) __asm__("lldt %%ax": /* no output */ :"a" (_LDT(n))) +#define load_TR(n) __asm__ __volatile__("ltr %%ax": /* no output */ :"a" (_TSS(n))) +#define load_ldt(n) __asm__ __volatile__("lldt %%ax": /* no output */ :"a" (_LDT(n))) #define store_TR(n) \ __asm__("str %%ax\n\t" \ "subl %2,%%eax\n\t" \ @@ -33,11 +33,9 @@ __asm__("str %%ax\n\t" \ /* This special macro can be used to load a debugging register */ #define loaddebug(tsk,register) \ - __asm__("movl %0,%%edx\n\t" \ - "movl %%edx,%%db" #register "\n\t" \ + __asm__("movl %0,%%db" #register \ : /* no output */ \ - :"m" (tsk->debugreg[register]) \ - :"dx"); + :"r" (tsk->debugreg[register])) /* @@ -251,7 +249,7 @@ __asm__ __volatile__ ("movw %%dx,%%ax\n\t" \ :"=m" (*((long *) (gate_addr))), \ "=m" (*(1+(long *) (gate_addr))) \ :"i" ((short) (0x8000+(dpl<<13)+(type<<8))), \ - "d" ((char *) (addr)),"a" (KERNEL_CS << 16) \ + "d" ((char *) (addr)),"a" (__KERNEL_CS << 16) \ :"ax","dx") #define set_intr_gate(n,addr) \ diff --git a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h index 84bb65f76..0ac6380fd 100644 --- a/include/asm-i386/uaccess.h +++ b/include/asm-i386/uaccess.h @@ -5,7 +5,6 @@ * User space memory access functions */ #include -#include #define VERIFY_READ 0 #define VERIFY_WRITE 1 @@ -18,24 +17,21 @@ * For historical reasons, these macros are grossly misnamed. */ -extern unsigned long __bad_fs_size(void); +#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) +#define KERNEL_DS MAKE_MM_SEG(0) +#define USER_DS MAKE_MM_SEG(3) -#define get_fs() (current->tss.segment) #define get_ds() (KERNEL_DS) +#define get_fs() (current->tss.segment) +#define set_fs(x) (current->tss.segment = (x)) -/* Some architectures -- Alpha for one -- use "segment" schemes that - require all bits to be preserved, thus the i386 traditional `ushort' - doesn't work. To head off problems early, force the Intel folks - to do it Right as well. */ +#define segment_eq(a,b) ((a).seg == (b).seg) -#define set_fs(x) (current->tss.segment = \ - sizeof(x) == sizeof(unsigned long) ? (x) \ - : __bad_fs_size()) /* * Address Ok: * - * low two bits of segment + * segment * 00 (kernel) 11 (user) * * high 00 1 1 @@ -44,12 +40,12 @@ extern unsigned long __bad_fs_size(void); * address 11 1 0 */ #define __addr_ok(x) \ - ((((unsigned long)(x)>>30)&get_fs()) != 3) + ((((unsigned long)(x)>>30)&get_fs().seg) != 3) #define __user_ok(addr,size) \ ((size <= 0xC0000000UL) && (addr <= 0xC0000000UL - size)) #define __kernel_ok \ - (!(get_fs() & 3)) + (!get_fs().seg) extern int __verify_write(const void *, unsigned long); diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index 2daadab53..1a45b75c3 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h @@ -178,6 +178,15 @@ #define __NR_setresgid 170 #define __NR_getresgid 171 #define __NR_prctl 172 +#define __NR_rt_sigreturn 173 +#define __NR_rt_sigaction 174 +#define __NR_rt_sigprocmask 175 +#define __NR_rt_sigpending 176 +#define __NR_rt_sigtimedwait 177 +#define __NR_rt_sigqueueinfo 178 +#define __NR_rt_sigsuspend 179 +#define __NR_pread 180 +#define __NR_pwrite 181 /* user-visible error numbers are in the range -1 - -122: see */ -- cgit v1.2.3