From 230e5ab6a084ed50470f101934782dbf54b0d06b Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Sat, 6 Dec 1997 23:51:34 +0000 Subject: Merge with Linux 2.1.67. --- include/asm-i386/bugs.h | 25 +++++++++++- include/asm-i386/delay.h | 60 ++++------------------------- include/asm-i386/elf.h | 2 +- include/asm-i386/io.h | 94 +++++++--------------------------------------- include/asm-i386/locks.h | 2 +- include/asm-i386/pgtable.h | 2 +- include/asm-i386/socket.h | 2 + include/asm-i386/system.h | 6 +-- include/asm-i386/unistd.h | 3 ++ 9 files changed, 55 insertions(+), 141 deletions(-) (limited to 'include/asm-i386') diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h index 2e83b1b48..b7f2e1507 100644 --- a/include/asm-i386/bugs.h +++ b/include/asm-i386/bugs.h @@ -142,7 +142,7 @@ __initfunc(static void check_popad(void)) : "edx" (inp) : "eax", "ecx", "edx", "edi" ); /* If this fails, it means that any user program may lock CPU hard. Too bad. */ - if (res != 12345678) printk( "Bad.\n" ); + if (res != 12345678) printk( "Buggy.\n" ); else printk( "Ok.\n" ); #endif } @@ -166,6 +166,28 @@ __initfunc(static void check_amd_k6(void)) } } +/* + * All current models of Pentium and Pentium with MMX technology CPUs + * have the F0 0F bug, which lets nonpriviledged users lock up the system: + */ + +extern int pentium_f00f_bug; +extern void trap_init_f00f_bug(void); + + +__initfunc(static void check_pentium_f00f(void)) +{ + /* + * Pentium and Pentium MMX + */ + pentium_f00f_bug = 0; + if (x86==5 && !memcmp(x86_vendor_id, "GenuineIntel", 12)) { + printk(KERN_INFO "Intel Pentium with F0 0F bug - workaround enabled.\n"); + pentium_f00f_bug = 1; + trap_init_f00f_bug(); + } +} + __initfunc(static void check_bugs(void)) { check_tlb(); @@ -173,5 +195,6 @@ __initfunc(static void check_bugs(void)) check_hlt(); check_popad(); check_amd_k6(); + check_pentium_f00f(); system_utsname.machine[1] = '0' + x86; } diff --git a/include/asm-i386/delay.h b/include/asm-i386/delay.h index 3435e4d1b..ebd9f9d93 100644 --- a/include/asm-i386/delay.h +++ b/include/asm-i386/delay.h @@ -4,61 +4,15 @@ /* * Copyright (C) 1993 Linus Torvalds * - * Delay routines, using a pre-computed "loops_per_second" value. + * Delay routines calling functions in arch/i386/lib/delay.c */ -#ifdef __SMP__ -#include -#endif +extern void __udelay(unsigned long usecs); +extern void __const_udelay(unsigned long usecs); +extern void __delay(unsigned long loops); -extern __inline__ void __delay(int loops) -{ - __asm__ __volatile__( - ".align 2,0x90\n1:\tdecl %0\n\tjns 1b" - :/* no outputs */ - :"a" (loops) - :"ax"); -} - -/* - * division by multiplication: you don't have to worry about - * loss of precision. - * - * Use only for very small delays ( < 1 msec). Should probably use a - * lookup table, really, as the multiplications take much too long with - * short delays. This is a "reasonable" implementation, though (and the - * first constant multiplications gets optimized away if the delay is - * a constant) - */ -extern __inline__ void __udelay(unsigned long usecs, unsigned long lps) -{ - usecs *= 0x000010c6; /* 2**32 / 1000000 */ - __asm__("mull %0" - :"=d" (usecs) - :"a" (usecs),"0" (lps) - :"ax"); - - __delay(usecs); -} - -#ifdef __SMP__ -#define __udelay_val cpu_data[smp_processor_id()].udelay_val -#else -#define __udelay_val loops_per_sec -#endif - -#define udelay(usecs) __udelay((usecs),__udelay_val) - - -extern __inline__ unsigned long muldiv(unsigned long a, unsigned long b, unsigned long c) -{ - __asm__("mull %1 ; divl %2" - :"=a" (a) - :"d" (b), - "r" (c), - "0" (a) - :"dx"); - return a; -} +#define udelay(n) (__builtin_constant_p(n) ? \ + __const_udelay((n) * 0x10c6) : \ + __udelay(n)) #endif /* defined(_I386_DELAY_H) */ diff --git a/include/asm-i386/elf.h b/include/asm-i386/elf.h index 46a4a7ada..1eae23267 100644 --- a/include/asm-i386/elf.h +++ b/include/asm-i386/elf.h @@ -24,7 +24,7 @@ typedef struct user_i387_struct elf_fpregset_t; * These are used to set parameters in the core dumps. */ #define ELF_CLASS ELFCLASS32 -#define ELF_DATA ELFDATA2LSB; +#define ELF_DATA ELFDATA2LSB #define ELF_ARCH EM_386 /* SVR4/i386 ABI (pages 3-31, 3-32) says that when the program starts %edx diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h index d5dba06d7..0d611cef4 100644 --- a/include/asm-i386/io.h +++ b/include/asm-i386/io.h @@ -25,14 +25,18 @@ * Linus */ + /* + * Bit simplified and optimized by Jan Hubicka + */ + #ifdef SLOW_IO_BY_JUMPING -#define __SLOW_DOWN_IO __asm__ __volatile__("jmp 1f\n1:\tjmp 1f\n1:") +#define __SLOW_DOWN_IO "\njmp 1f\n1:\tjmp 1f\n1:" #else -#define __SLOW_DOWN_IO __asm__ __volatile__("outb %al,$0x80") +#define __SLOW_DOWN_IO "\noutb %%al,$0x80" #endif #ifdef REALLY_SLOW_IO -#define SLOW_DOWN_IO { __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; __SLOW_DOWN_IO; } +#define SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO __SLOW_DOWN_IO #else #define SLOW_DOWN_IO __SLOW_DOWN_IO #endif @@ -40,30 +44,25 @@ /* * Talk about misusing macros.. */ - #define __OUT1(s,x) \ -extern inline void __out##s(unsigned x value, unsigned short port) { +extern inline void out##s(unsigned x value, unsigned short port) { #define __OUT2(s,s1,s2) \ __asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1" #define __OUT(s,s1,x) \ -__OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); } \ -__OUT1(s##c,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); } \ -__OUT1(s##_p,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); SLOW_DOWN_IO; } \ -__OUT1(s##c_p,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); SLOW_DOWN_IO; } +__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));} \ #define __IN1(s) \ -extern inline RETURN_TYPE __in##s(unsigned short port) { RETURN_TYPE _v; +extern inline RETURN_TYPE in##s(unsigned short port) { RETURN_TYPE _v; #define __IN2(s,s1,s2) \ __asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0" #define __IN(s,s1,i...) \ -__IN1(s) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); return _v; } \ -__IN1(s##c) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); return _v; } \ -__IN1(s##_p) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); SLOW_DOWN_IO; return _v; } \ -__IN1(s##c_p) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); SLOW_DOWN_IO; return _v; } +__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; } \ #define __INS(s) \ extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \ @@ -76,11 +75,9 @@ extern inline void outs##s(unsigned short port, const void * addr, unsigned long : "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); } #define RETURN_TYPE unsigned char -/* __IN(b,"b","0" (0)) */ __IN(b,"") #undef RETURN_TYPE #define RETURN_TYPE unsigned short -/* __IN(w,"w","0" (0)) */ __IN(w,"") #undef RETURN_TYPE #define RETURN_TYPE unsigned int @@ -99,71 +96,6 @@ __OUTS(b) __OUTS(w) __OUTS(l) -/* - * Note that due to the way __builtin_constant_p() works, you - * - can't use it inside an inline function (it will never be true) - * - you don't have to worry about side effects within the __builtin.. - */ -#define outb(val,port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __outbc((val),(port)) : \ - __outb((val),(port))) - -#define inb(port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __inbc(port) : \ - __inb(port)) - -#define outb_p(val,port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __outbc_p((val),(port)) : \ - __outb_p((val),(port))) - -#define inb_p(port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __inbc_p(port) : \ - __inb_p(port)) - -#define outw(val,port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __outwc((val),(port)) : \ - __outw((val),(port))) - -#define inw(port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __inwc(port) : \ - __inw(port)) - -#define outw_p(val,port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __outwc_p((val),(port)) : \ - __outw_p((val),(port))) - -#define inw_p(port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __inwc_p(port) : \ - __inw_p(port)) - -#define outl(val,port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __outlc((val),(port)) : \ - __outl((val),(port))) - -#define inl(port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __inlc(port) : \ - __inl(port)) - -#define outl_p(val,port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __outlc_p((val),(port)) : \ - __outl_p((val),(port))) - -#define inl_p(port) \ -((__builtin_constant_p((port)) && (port) < 256) ? \ - __inlc_p(port) : \ - __inl_p(port)) - #ifdef __KERNEL__ #include diff --git a/include/asm-i386/locks.h b/include/asm-i386/locks.h index 357d309fa..a075e92bd 100644 --- a/include/asm-i386/locks.h +++ b/include/asm-i386/locks.h @@ -38,7 +38,7 @@ extern __inline__ void prim_spin_lock(struct spinlock *sp) * Wait for any invalidates to go off */ - if(smp_invalidate_needed&(1<spins++; diff --git a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h index 9274056f8..61d94b8b9 100644 --- a/include/asm-i386/pgtable.h +++ b/include/asm-i386/pgtable.h @@ -37,7 +37,7 @@ #define __flush_tlb() \ do { unsigned long tmpreg; __asm__ __volatile__("movl %%cr3,%0\n\tmovl %0,%%cr3":"=r" (tmpreg) : :"memory"); } while (0) -#ifdef CONFIG_M386 +#if defined(CONFIG_M386) || defined(CONFIG_AMD_K5_INVBUG) #define __flush_tlb_one(addr) flush_tlb() #else #define __flush_tlb_one(addr) \ diff --git a/include/asm-i386/socket.h b/include/asm-i386/socket.h index a6d3a5fa7..e09eaea21 100644 --- a/include/asm-i386/socket.h +++ b/include/asm-i386/socket.h @@ -33,6 +33,8 @@ #define SO_SECURITY_ENCRYPTION_TRANSPORT 23 #define SO_SECURITY_ENCRYPTION_NETWORK 24 +#define SO_BINDTODEVICE 25 + /* Socket types. */ #define SOCK_STREAM 1 /* stream (connection) socket */ #define SOCK_DGRAM 2 /* datagram (conn.less) socket */ diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h index 94e01ec2a..9dcc21b44 100644 --- a/include/asm-i386/system.h +++ b/include/asm-i386/system.h @@ -255,13 +255,13 @@ __asm__ __volatile__ ("movw %%dx,%%ax\n\t" \ :"ax","dx") #define set_intr_gate(n,addr) \ - _set_gate(&idt[n],14,0,addr) + _set_gate(idt+(n),14,0,addr) #define set_trap_gate(n,addr) \ - _set_gate(&idt[n],15,0,addr) + _set_gate(idt+(n),15,0,addr) #define set_system_gate(n,addr) \ - _set_gate(&idt[n],15,3,addr) + _set_gate(idt+(n),15,3,addr) #define set_call_gate(a,addr) \ _set_gate(a,12,3,addr) diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index 66efafee9..2daadab53 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h @@ -177,6 +177,7 @@ #define __NR_nfsservctl 169 #define __NR_setresgid 170 #define __NR_getresgid 171 +#define __NR_prctl 172 /* user-visible error numbers are in the range -1 - -122: see */ @@ -277,6 +278,8 @@ static inline _syscall1(int,setup,int,magic) static inline _syscall0(int,sync) static inline _syscall0(pid_t,setsid) static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count) +static inline _syscall3(int,read,int,fd,char *,buf,off_t,count) +static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count) static inline _syscall1(int,dup,int,fd) static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp) static inline _syscall3(int,open,const char *,file,int,flag,int,mode) -- cgit v1.2.3