diff options
Diffstat (limited to 'include/asm-i386')
-rw-r--r-- | include/asm-i386/bugs.h | 4 | ||||
-rw-r--r-- | include/asm-i386/checksum.h | 27 | ||||
-rw-r--r-- | include/asm-i386/desc.h | 61 | ||||
-rw-r--r-- | include/asm-i386/dma.h | 19 | ||||
-rw-r--r-- | include/asm-i386/fcntl.h | 2 | ||||
-rw-r--r-- | include/asm-i386/fixmap.h | 2 | ||||
-rw-r--r-- | include/asm-i386/keyboard.h | 26 | ||||
-rw-r--r-- | include/asm-i386/linux_logo.h | 5 | ||||
-rw-r--r-- | include/asm-i386/mtrr.h | 3 | ||||
-rw-r--r-- | include/asm-i386/namei.h | 4 | ||||
-rw-r--r-- | include/asm-i386/processor.h | 22 | ||||
-rw-r--r-- | include/asm-i386/resource.h | 2 | ||||
-rw-r--r-- | include/asm-i386/semaphore.h | 5 | ||||
-rw-r--r-- | include/asm-i386/shmparam.h | 4 | ||||
-rw-r--r-- | include/asm-i386/spinlock.h | 23 | ||||
-rw-r--r-- | include/asm-i386/system.h | 20 | ||||
-rw-r--r-- | include/asm-i386/termios.h | 4 | ||||
-rw-r--r-- | include/asm-i386/unistd.h | 34 |
18 files changed, 175 insertions, 92 deletions
diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h index ba3a969ae..5cd7e94d6 100644 --- a/include/asm-i386/bugs.h +++ b/include/asm-i386/bugs.h @@ -29,9 +29,7 @@ __initfunc(static void no_halt(char *s, int *ints)) __initfunc(static void no_387(char *s, int *ints)) { boot_cpu_data.hard_math = 0; - __asm__("movl %%cr0,%%eax\n\t" - "orl $0xE,%%eax\n\t" - "movl %%eax,%%cr0\n\t" : : : "ax"); + write_cr0(0xE | read_cr0()); } static char __initdata fpu_error = 0; diff --git a/include/asm-i386/checksum.h b/include/asm-i386/checksum.h index cad2910fe..8ec5f9c8d 100644 --- a/include/asm-i386/checksum.h +++ b/include/asm-i386/checksum.h @@ -27,22 +27,25 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) unsigned int csum_partial_copy_generic( const char *src, char *dst, int len, int sum, int *src_err_ptr, int *dst_err_ptr); +/* + * Note: when you get a NULL pointer exception here this means someone + * passed in an incorrect kernel address to one of these functions. + * + * If you use these functions directly please don't forget the + * verify_area(). + */ extern __inline__ unsigned int csum_partial_copy_nocheck ( const char *src, char *dst, int len, int sum) { - int *src_err_ptr=NULL, *dst_err_ptr=NULL; - - return csum_partial_copy_generic ( src, dst, len, sum, src_err_ptr, dst_err_ptr); + return csum_partial_copy_generic ( src, dst, len, sum, NULL, NULL); } extern __inline__ unsigned int csum_partial_copy_from_user ( const char *src, char *dst, int len, int sum, int *err_ptr) { - int *dst_err_ptr=NULL; - - return csum_partial_copy_generic ( src, dst, len, sum, err_ptr, dst_err_ptr); + return csum_partial_copy_generic ( src, dst, len, sum, err_ptr, NULL); } #if 0 @@ -59,9 +62,7 @@ extern __inline__ unsigned int csum_partial_copy_to_user ( const char *src, char *dst, int len, int sum, int *err_ptr) { - int *src_err_ptr=NULL; - - return csum_partial_copy_generic ( src, dst, len, sum, src_err_ptr, err_ptr); + return csum_partial_copy_generic ( src, dst, len, sum, NULL, err_ptr); } #endif @@ -202,15 +203,13 @@ static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr, static __inline__ unsigned int csum_and_copy_to_user (const char *src, char *dst, int len, int sum, int *err_ptr) { - int *src_err_ptr=NULL; - - if (verify_area(VERIFY_WRITE, dst, len) == 0) - return csum_partial_copy_generic(src, dst, len, sum, src_err_ptr, err_ptr); + if (access_ok(VERIFY_WRITE, dst, len)) + return csum_partial_copy_generic(src, dst, len, sum, NULL, err_ptr); if (len) *err_ptr = -EFAULT; - return sum; + return -1; /* invalid checksum */ } #endif diff --git a/include/asm-i386/desc.h b/include/asm-i386/desc.h new file mode 100644 index 000000000..e91580e04 --- /dev/null +++ b/include/asm-i386/desc.h @@ -0,0 +1,61 @@ +#ifndef __ARCH_DESC_H +#define __ARCH_DESC_H + +struct desc_struct { + unsigned long a,b; +}; + +extern struct desc_struct gdt_table[]; +extern struct desc_struct *idt, *gdt; + +struct Xgt_desc_struct { + unsigned short size; + unsigned long address __attribute__((packed)); +}; + +#define idt_descr (*(struct Xgt_desc_struct *)((char *)&idt - 2)) +#define gdt_descr (*(struct Xgt_desc_struct *)((char *)&gdt - 2)) + +/* + * Entry into gdt where to find first TSS. GDT layout: + * 0 - null + * 1 - not used + * 2 - kernel code segment + * 3 - kernel data segment + * 4 - user code segment + * 5 - user data segment + * 6 - not used + * 7 - not used + * 8 - APM BIOS support + * 9 - APM BIOS support + * 10 - APM BIOS support + * 11 - APM BIOS support + * 12 - TSS #0 + * 13 - LDT #0 + * 14 - TSS #1 + * 15 - LDT #1 + */ +#define FIRST_TSS_ENTRY 12 +#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__ __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" \ + "shrl $4,%%eax" \ + :"=a" (n) \ + :"0" (0),"i" (FIRST_TSS_ENTRY<<3)) + +extern void set_intr_gate(unsigned int irq, void * addr); +extern void set_ldt_desc(unsigned int n, void *addr, unsigned int size); +extern void set_tss_desc(unsigned int n, void *addr); + +/* + * This is the ldt that every process will get unless we need + * something other than this. + */ +extern struct desc_struct default_ldt; + +#endif diff --git a/include/asm-i386/dma.h b/include/asm-i386/dma.h index 0d45967da..58f7bfc05 100644 --- a/include/asm-i386/dma.h +++ b/include/asm-i386/dma.h @@ -9,6 +9,8 @@ #define _ASM_DMA_H #include <asm/io.h> /* need byte IO */ +#include <asm/spinlock.h> /* And spinlocks */ +#include <linux/delay.h> #ifdef HAVE_REALLY_SLOW_DMA_CONTROLLER @@ -129,6 +131,21 @@ #define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */ #define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */ + +extern spinlock_t dma_spin_lock; + +static __inline__ unsigned long claim_dma_lock(void) +{ + unsigned long flags; + spin_lock_irqsave(&dma_spin_lock, flags); + return flags; +} + +static __inline__ void release_dma_lock(unsigned long flags) +{ + spin_unlock_irqrestore(&dma_spin_lock, flags); +} + /* enable/disable a specific DMA channel */ static __inline__ void enable_dma(unsigned int dmanr) { @@ -151,7 +168,7 @@ static __inline__ void disable_dma(unsigned int dmanr) * Use this once to initialize the FF to a known state. * After that, keep track of it. :-) * --- In order to do that, the DMA routines below should --- - * --- only be used while interrupts are disabled! --- + * --- only be used while holding the DMA lock ! --- */ static __inline__ void clear_dma_ff(unsigned int dmanr) { diff --git a/include/asm-i386/fcntl.h b/include/asm-i386/fcntl.h index f0ddc3e61..eff29ac8f 100644 --- a/include/asm-i386/fcntl.h +++ b/include/asm-i386/fcntl.h @@ -18,6 +18,8 @@ #define FASYNC 020000 /* fcntl, for BSD compatibility */ #define O_DIRECT 040000 /* direct disk access hint - currently ignored */ #define O_LARGEFILE 0100000 +#define O_DIRECTORY 0200000 /* must be a directory */ +#define O_NOFOLLOW 0400000 /* don't follow links */ #define F_DUPFD 0 /* dup */ #define F_GETFD 1 /* get f_flags */ diff --git a/include/asm-i386/fixmap.h b/include/asm-i386/fixmap.h index dc9d624d7..ae6f062dd 100644 --- a/include/asm-i386/fixmap.h +++ b/include/asm-i386/fixmap.h @@ -40,7 +40,7 @@ * fix-mapped? */ enum fixed_addresses { -#if __SMP__ +#ifdef __SMP__ FIX_APIC_BASE, FIX_IO_APIC_BASE, #endif diff --git a/include/asm-i386/keyboard.h b/include/asm-i386/keyboard.h index 462095732..a30e49946 100644 --- a/include/asm-i386/keyboard.h +++ b/include/asm-i386/keyboard.h @@ -3,7 +3,7 @@ * * Created 3 Nov 1996 by Geert Uytterhoeven * - * $Id: keyboard.h,v 1.5 1997/08/05 09:44:29 ralf Exp $ + * $Id: keyboard.h,v 1.6 1998/10/28 12:40:06 ralf Exp $ */ /* @@ -52,8 +52,11 @@ extern unsigned char pckbd_sysrq_xlate[128]; /* Some stoneage hardware needs delays after some operations. */ #define kbd_pause() do { SLOW_DOWN_IO; } while(0) -#define keyboard_setup() \ - request_region(0x60, 16, "keyboard") +/* Get the keyboard controller registers (incomplete decode) */ +#define kbd_request_region() request_region(0x60, 16, "keyboard") + +#define kbd_request_irq() request_irq(KEYBOARD_IRQ, keyboard_interrupt, 0, \ + "keyboard", NULL); /* * Machine specific bits for the PS/2 driver @@ -63,21 +66,16 @@ extern unsigned char pckbd_sysrq_xlate[128]; #ifdef CONFIG_MCA -#define ps2_request_irq() \ - request_irq(AUX_IRQ, aux_interrupt, MCA_bus ? SA_SHIRQ : 0, \ - "PS/2 Mouse", inode) +#define aux_request_irq(handler, dev_id) request_irq(AUX_IRQ, handler, \ + MCA_bus ? SA_SHIRQ : 0, "PS/2 Mouse", dev_id) +#define aux_free_irq(dev_id) free_irq(AUX_IRQ, dev_id) #else /* !defined(CONFIG_MCA) */ -#define ps2_request_irq() \ - request_irq(AUX_IRQ, aux_interrupt, 0, "PS/2 Mouse", NULL) - -#endif /* !defined(CONFIG_MCA) */ +#define aux_request_irq(handler, dev_id) request_irq(AUX_IRQ, handler, 0, \ + "PS/2 Mouse", NULL) +#define aux_free_irq(dev_id) free_irq(AUX_IRQ, NULL) -#ifdef CONFIG_MCA -#define ps2_free_irq(inode) free_irq(AUX_IRQ, inode) -#else -#define ps2_free_irq(inode) free_irq(AUX_IRQ, NULL) #endif #endif /* __KERNEL__ */ diff --git a/include/asm-i386/linux_logo.h b/include/asm-i386/linux_logo.h index 6773bef77..452bee7da 100644 --- a/include/asm-i386/linux_logo.h +++ b/include/asm-i386/linux_logo.h @@ -1,4 +1,4 @@ -/* $Id: linux_logo.h,v 1.6 1998/07/07 13:34:56 jj Exp $ +/* $Id: linux_logo.h,v 1.8 1998/07/30 16:30:24 jj Exp $ * include/asm-i386/linux_logo.h: This is a linux logo * to be displayed on boot. * @@ -23,10 +23,11 @@ #define linux_logo_banner "Linux/ia32 version " UTS_RELEASE -#define LINUX_LOGO_COLORS 221 +#define LINUX_LOGO_COLORS 214 #ifdef INCLUDE_LINUX_LOGO_DATA +#define INCLUDE_LINUX_LOGOBW #define INCLUDE_LINUX_LOGO16 #include <linux/linux_logo.h> diff --git a/include/asm-i386/mtrr.h b/include/asm-i386/mtrr.h index 7e387cfc6..5b1e8470c 100644 --- a/include/asm-i386/mtrr.h +++ b/include/asm-i386/mtrr.h @@ -85,7 +85,8 @@ static __inline__ int mtrr_add (unsigned long base, unsigned long size, { return -ENODEV; } -static __inline__ mtrr_del (int reg, unsigned long base, unsigned long size) +static __inline__ int mtrr_del (int reg, unsigned long base, + unsigned long size) { return -ENODEV; } diff --git a/include/asm-i386/namei.h b/include/asm-i386/namei.h index 981627be7..5708ffd8d 100644 --- a/include/asm-i386/namei.h +++ b/include/asm-i386/namei.h @@ -12,7 +12,7 @@ * Look at asm-sparc/namei.h for details. */ -#define __prefix_namei(retrieve_mode, name, base, buf, res_dir, res_inode, \ - last_name, last_entry, last_error) 1 +#define __prefix_lookup_dentry(name, lookup_flags) \ + do {} while (0) #endif /* __I386_NAMEI_H */ diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 3a9968c69..1b1e97d73 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h @@ -275,12 +275,34 @@ struct mm_struct; /* Free all resources held by a thread. */ extern void release_thread(struct task_struct *); +extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); /* Copy and release all segment info associated with a VM */ extern void copy_segments(int nr, struct task_struct *p, struct mm_struct * mm); extern void release_segments(struct mm_struct * mm); /* + * FPU lazy state save handling.. + */ +#define save_fpu(tsk) do { \ + asm volatile("fnsave %0\n\tfwait":"=m" (tsk->tss.i387)); \ + tsk->flags &= ~PF_USEDFPU; \ + stts(); \ +} while (0) + +#define unlazy_fpu(tsk) do { \ + if (tsk->flags & PF_USEDFPU) \ + save_fpu(tsk); \ +} while (0) + +#define clear_fpu(tsk) do { \ + if (tsk->flags & PF_USEDFPU) { \ + tsk->flags &= ~PF_USEDFPU; \ + stts(); \ + } \ +} while (0) + +/* * Return saved PC of a blocked thread. */ extern inline unsigned long thread_saved_pc(struct thread_struct *t) diff --git a/include/asm-i386/resource.h b/include/asm-i386/resource.h index 3143b5bb2..e7e2d1159 100644 --- a/include/asm-i386/resource.h +++ b/include/asm-i386/resource.h @@ -25,7 +25,7 @@ { LONG_MAX, LONG_MAX }, \ { LONG_MAX, LONG_MAX }, \ { LONG_MAX, LONG_MAX }, \ - { _STK_LIM, _STK_LIM }, \ + { _STK_LIM, LONG_MAX }, \ { 0, LONG_MAX }, \ { LONG_MAX, LONG_MAX }, \ { MAX_TASKS_PER_USER, MAX_TASKS_PER_USER }, \ diff --git a/include/asm-i386/semaphore.h b/include/asm-i386/semaphore.h index a68b23fc6..2cb1b891c 100644 --- a/include/asm-i386/semaphore.h +++ b/include/asm-i386/semaphore.h @@ -36,8 +36,9 @@ asmlinkage void __down_failed(void /* special register calling convention */); asmlinkage int __down_failed_interruptible(void /* params in registers */); asmlinkage void __up_wakeup(void /* special register calling convention */); -extern void __down(struct semaphore * sem); -extern void __up(struct semaphore * sem); +asmlinkage void __down(struct semaphore * sem); +asmlinkage int __down_interruptible(struct semaphore * sem); +asmlinkage void __up(struct semaphore * sem); extern spinlock_t semaphore_wake_lock; diff --git a/include/asm-i386/shmparam.h b/include/asm-i386/shmparam.h index 522718965..64472231f 100644 --- a/include/asm-i386/shmparam.h +++ b/include/asm-i386/shmparam.h @@ -33,7 +33,9 @@ * SHMMAX <= (PAGE_SIZE << _SHM_IDX_BITS). */ -#define SHMMAX 0x1000000 /* max shared seg size (bytes) */ +#define SHMMAX 0x2000000 /* max shared seg size (bytes) */ +/* Try not to change the default shipped SHMMAX - people rely on it */ + #define SHMMIN 1 /* really PAGE_SIZE */ /* min shared seg size (bytes) */ #define SHMMNI (1<<_SHM_ID_BITS) /* max num of segs system wide */ #define SHMALL /* max shm system wide (pages) */ \ diff --git a/include/asm-i386/spinlock.h b/include/asm-i386/spinlock.h index e6fdf42f1..00e238407 100644 --- a/include/asm-i386/spinlock.h +++ b/include/asm-i386/spinlock.h @@ -14,10 +14,10 @@ */ #if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) typedef struct { } spinlock_t; - #define SPIN_LOCK_UNLOCKED { } + #define SPIN_LOCK_UNLOCKED (spinlock_t) { } #else typedef struct { int gcc_is_buggy; } spinlock_t; - #define SPIN_LOCK_UNLOCKED { 0 } + #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } #endif #define spin_lock_init(lock) do { } while(0) @@ -38,7 +38,7 @@ typedef struct { volatile unsigned int lock; } spinlock_t; -#define SPIN_LOCK_UNLOCKED { 0 } +#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } #define spin_lock_init(x) do { (x)->lock = 0; } while (0) #define spin_trylock(lock) (!test_and_set_bit(0,(lock))) @@ -61,7 +61,7 @@ typedef struct { volatile unsigned int babble; const char *module; } spinlock_t; -#define SPIN_LOCK_UNLOCKED { 0, 25, __BASE_FILE__ } +#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 25, __BASE_FILE__ } #include <linux/kernel.h> @@ -88,9 +88,16 @@ typedef struct { * can "mix" irq-safe locks - any writer needs to get a * irq-safe write-lock, but readers can get non-irqsafe * read-locks. + * + * Gcc-2.7.x has a nasty bug with empty initializers. */ -typedef struct { } rwlock_t; -#define RW_LOCK_UNLOCKED { } +#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8) + typedef struct { } rwlock_t; + #define RW_LOCK_UNLOCKED (rwlock_t) { } +#else + typedef struct { int gcc_is_buggy; } rwlock_t; + #define RW_LOCK_UNLOCKED (rwlock_t) { 0 } +#endif #define read_lock(lock) do { } while(0) #define read_unlock(lock) do { } while(0) @@ -120,7 +127,7 @@ typedef struct { volatile unsigned int lock; } spinlock_t; -#define SPIN_LOCK_UNLOCKED { 0 } +#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 } #define spin_lock_init(x) do { (x)->lock = 0; } while(0) /* @@ -188,7 +195,7 @@ typedef struct { unsigned long previous; } rwlock_t; -#define RW_LOCK_UNLOCKED { 0, 0 } +#define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 } /* * On x86, we implement read-write locks as a 32-bit counter diff --git a/include/asm-i386/system.h b/include/asm-i386/system.h index cb04cefe4..65012f648 100644 --- a/include/asm-i386/system.h +++ b/include/asm-i386/system.h @@ -88,7 +88,7 @@ static inline unsigned long _get_base(char * addr) "1:\t" \ "movl %0,%%" #seg "\n" \ "2:\n" \ - ".section fixup,\"ax\"\n" \ + ".section .fixup,\"ax\"\n" \ "3:\t" \ "pushl $0\n\t" \ "popl %%" #seg "\n\t" \ @@ -104,14 +104,16 @@ static inline unsigned long _get_base(char * addr) * Clear and set 'TS' bit respectively */ #define clts() __asm__ __volatile__ ("clts") -#define stts() \ -__asm__ __volatile__ ( \ - "movl %%cr0,%%eax\n\t" \ - "orl $8,%%eax\n\t" \ - "movl %%eax,%%cr0" \ - : /* no outputs */ \ - : /* no inputs */ \ - :"ax") +#define read_cr0() ({ \ + unsigned int __dummy; \ + __asm__( \ + "movl %%cr0,%0\n\t" \ + :"=r" (__dummy)); \ + __dummy; \ +}) +#define write_cr0(x) \ + __asm__("movl %0,%%cr0": :"r" (x)); +#define stts() write_cr0(8 | read_cr0()) #endif /* __KERNEL__ */ diff --git a/include/asm-i386/termios.h b/include/asm-i386/termios.h index b2b77853f..cf6b5cd67 100644 --- a/include/asm-i386/termios.h +++ b/include/asm-i386/termios.h @@ -47,7 +47,9 @@ struct termio { #define N_AX25 5 #define N_X25 6 /* X.25 async */ #define N_6PACK 7 -#define N_MASC 8 /* Reserved fo Mobitex module <kaz@cafe.net> */ +#define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ +#define N_R3964 9 /* Reserved for Simatic R3964 module */ +#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ #ifdef __KERNEL__ diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index b354c47aa..76c7241bf 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h @@ -192,8 +192,8 @@ #define __NR_capset 185 #define __NR_sigaltstack 186 #define __NR_sendfile 187 -#define __NR_streams1 188 /* some people actually want it */ -#define __NR_streams2 189 /* some people actually want it */ +#define __NR_getpmsg 188 /* some people actually want streams */ +#define __NR_putpmsg 189 /* some people actually want streams */ /* user-visible error numbers are in the range -1 - -122: see <asm-i386/errno.h> */ @@ -306,36 +306,6 @@ static inline pid_t wait(int * wait_stat) return waitpid(-1,wait_stat,0); } -/* - * This is the mechanism for creating a new kernel thread. - * - * NOTE! Only a kernel-only process(ie the swapper or direct descendants - * who haven't done an "execve()") should use this: it will work within - * a system call from a "real" process, but the process memory space will - * not be free'd until both the parent and the child have exited. - */ -static inline pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) -{ - long retval; - - __asm__ __volatile__( - "movl %%esp,%%esi\n\t" - "int $0x80\n\t" /* Linux/i386 system call */ - "cmpl %%esp,%%esi\n\t" /* child or parent? */ - "je 1f\n\t" /* parent - jump */ - "pushl %3\n\t" /* push argument */ - "call *%4\n\t" /* call fn */ - "movl %2,%0\n\t" /* exit */ - "int $0x80\n" - "1:\t" - :"=a" (retval) - :"0" (__NR_clone), "i" (__NR_exit), - "r" (arg), "r" (fn), - "b" (flags | CLONE_VM) - :"si"); - return retval; -} - #endif #endif /* _ASM_I386_UNISTD_H_ */ |