diff options
Diffstat (limited to 'include')
65 files changed, 2380 insertions, 610 deletions
diff --git a/include/asm-alpha/byteorder.h b/include/asm-alpha/byteorder.h index 438ecb89c..a753084ce 100644 --- a/include/asm-alpha/byteorder.h +++ b/include/asm-alpha/byteorder.h @@ -14,90 +14,65 @@ #define __LITTLE_ENDIAN_BITFIELD #endif -#ifdef __KERNEL__ - -/* - * In-kernel byte order macros to handle stuff like - * byte-order-dependent filesystems etc. - */ -#define cpu_to_le32(x) (x) -#define le32_to_cpu(x) (x) -#define cpu_to_le16(x) (x) -#define le16_to_cpu(x) (x) - -#define cpu_to_be32(x) htonl((x)) -#define be32_to_cpu(x) ntohl((x)) -#define cpu_to_be16(x) htons((x)) -#define be16_to_cpu(x) ntohs((x)) - -#endif /* __KERNEL__ */ - -extern unsigned long int ntohl(unsigned long int); +extern unsigned int ntohl(unsigned int); extern unsigned short int ntohs(unsigned short int); -extern unsigned long int htonl(unsigned long int); +extern unsigned int htonl(unsigned int); extern unsigned short int htons(unsigned short int); -extern unsigned long int __ntohl(unsigned long int); +extern unsigned int __ntohl(unsigned int); extern unsigned short int __ntohs(unsigned short int); #ifdef __GNUC__ -extern unsigned long int __constant_ntohl(unsigned long int); +extern unsigned int __constant_ntohl(unsigned int); extern unsigned short int __constant_ntohs(unsigned short int); -/* - * The constant and non-constant versions here are the same. - * Maybe I'll come up with an alpha-optimized routine for the - * non-constant ones (the constant ones don't need it: gcc - * will optimize it to the correct constant) - */ - -extern __inline__ unsigned long int -__ntohl(unsigned long int x) +extern __inline__ unsigned int +__ntohl(unsigned int x) { - unsigned long int res, t1, t2; + unsigned int t1, t2, t3; + + /* Break the final or's out of the block so that gcc can + schedule them at will. Further, use add not or so that + we elide the sign extend gcc will put in because the + return type is not a long. */ __asm__( - "# bswap input: %0 (aabbccdd)\n\t" - "# output: %0, used %1 %2\n\t" - "extlh %0,5,%1 # %1 = dd000000\n\t" - "zap %0,0xfd,%2 # %2 = 0000cc00\n\t" - "sll %2,5,%2 # %2 = 00198000\n\t" - "s8addq %2,%1,%1 # %1 = ddcc0000\n\t" - "zap %0,0xfb,%2 # %2 = 00bb0000\n\t" - "srl %2,8,%2 # %2 = 0000bb00\n\t" - "extbl %0,3,%0 # %0 = 000000aa\n\t" - "or %1,%0,%0 # %0 = ddcc00aa\n\t" - "or %2,%0,%0 # %0 = ddccbbaa\n" - : "r="(res), "r="(t1), "r="(t2) - : "0" (x & 0xffffffffUL)); - return res; + "insbl %3,3,%1 # %1 = dd000000\n\t" + "zapnot %3,2,%2 # %2 = 0000cc00\n\t" + "sll %2,8,%2 # %2 = 00cc0000\n\t" + "or %2,%1,%1 # %1 = ddcc0000\n\t" + "zapnot %3,4,%2 # %2 = 00bb0000\n\t" + "extbl %3,3,%0 # %0 = 000000aa\n\t" + "srl %2,8,%2 # %2 = 0000bb00" + : "=r"(t3), "=&r"(t1), "=&r"(t2) + : "r"(x)); + + return t3 + t2 + t1; } #define __constant_ntohl(x) \ - ((unsigned long int)((((x) & 0x000000ffUL) << 24) | \ - (((x) & 0x0000ff00UL) << 8) | \ - (((x) & 0x00ff0000UL) >> 8) | \ - (((x) & 0xff000000UL) >> 24))) + ((unsigned int)((((x) & 0x000000ff) << 24) | \ + (((x) & 0x0000ff00) << 8) | \ + (((x) & 0x00ff0000) >> 8) | \ + (((x) & 0xff000000) >> 24))) extern __inline__ unsigned short int __ntohs(unsigned short int x) { - unsigned long int res, t1; + unsigned short int t1, t2; __asm__( - "# v0 is result; swap in-place.\n\t" - "bis %2,%2,%0 # v0 = aabb\n\t" - "extwh %0,7,%1 # t1 = bb00\n\t" - "extbl %0,1,%0 # v0 = 00aa\n\t" - "bis %0,%1,%0 # v0 = bbaa\n" - : "r="(res), "r="(t1) : "r"(x)); - return res; + "insbl %2,1,%1 # %1 = bb00\n\t" + "extbl %2,1,%0 # %0 = 00aa" + : "=r"(t1), "=&r"(t2) : "r"(x)); + + return t1 | t2; } #define __constant_ntohs(x) \ -((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \ - (((unsigned short int)(x) & 0xff00) >> 8))) +((unsigned short int)((((x) & 0x00ff) << 8) | \ + (((x) & 0xff00) >> 8))) #define __htonl(x) __ntohl(x) #define __htons(x) __ntohs(x) @@ -125,4 +100,69 @@ __ntohs(unsigned short int x) #endif /* __GNUC__ */ +#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); +} + +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); +} + +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 /* _ALPHA_BYTEORDER_H */ diff --git a/include/asm-alpha/fpu.h b/include/asm-alpha/fpu.h index f32b95f27..25148b14b 100644 --- a/include/asm-alpha/fpu.h +++ b/include/asm-alpha/fpu.h @@ -57,8 +57,28 @@ IEEE_STATUS_OVF | IEEE_STATUS_UNF | \ IEEE_STATUS_INE) +#define IEEE_SW_MASK (IEEE_TRAP_ENABLE_MASK | IEEE_STATUS_MASK) + #define IEEE_STATUS_TO_EXCSUM_SHIFT 16 #define IEEE_INHERIT (1UL<<63) /* inherit on thread create? */ +/* + * Convert the spftware IEEE trap enable and status bits into the + * hardware fpcr format. + */ + +static inline unsigned long +ieee_swcr_to_fpcr(unsigned long sw) +{ + unsigned long fp; + fp = (sw & IEEE_STATUS_MASK) << 35; + fp |= sw & IEEE_STATUS_MASK ? FPCR_SUM : 0; + fp |= (~sw & (IEEE_TRAP_ENABLE_INV + | IEEE_TRAP_ENABLE_DZE + | IEEE_TRAP_ENABLE_OVF)) << 48; + fp |= (~sw & (IEEE_TRAP_ENABLE_UNF | IEEE_TRAP_ENABLE_INE)) << 57; + return fp; +} + #endif /* __ASM_ALPHA_FPU_H */ diff --git a/include/asm-alpha/keyboard.h b/include/asm-alpha/keyboard.h index 1edaa52bb..3caa220eb 100644 --- a/include/asm-alpha/keyboard.h +++ b/include/asm-alpha/keyboard.h @@ -19,10 +19,6 @@ #define KEYBOARD_IRQ 1 #define DISABLE_KBD_DURING_INTERRUPTS 0 -#define KBD_REPORT_ERR -#define KBD_REPORT_UNKN -/* #define KBD_IS_FOCUS_9000 */ - extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode); extern int pckbd_getkeycode(unsigned int scancode); extern int pckbd_pretranslate(unsigned char scancode, char raw_mode); diff --git a/include/asm-alpha/namei.h b/include/asm-alpha/namei.h index a03cc1e8b..22e14bdce 100644 --- a/include/asm-alpha/namei.h +++ b/include/asm-alpha/namei.h @@ -7,15 +7,12 @@ #ifndef __ALPHA_NAMEI_H #define __ALPHA_NAMEI_H -/* These dummy routines maybe changed to something useful +/* This dummy routine maybe changed to something useful * for /usr/gnemul/ emulation stuff. * Look at asm-sparc/namei.h for details. */ -#define translate_namei(pathname, base, follow_links, res_inode) \ - do { } while (0) - -#define translate_open_namei(pathname, flag, mode, res_inode, base) \ - do { } while (0) +#define __prefix_namei(retrieve_mode, name, base, buf, res_dir, res_inode, \ + last_name, last_entry, last_error) 1 #endif /* __ALPHA_NAMEI_H */ diff --git a/include/asm-alpha/processor.h b/include/asm-alpha/processor.h index 93bc9e31a..17674b56d 100644 --- a/include/asm-alpha/processor.h +++ b/include/asm-alpha/processor.h @@ -43,6 +43,7 @@ struct thread_struct { /* the fields below are Linux-specific: */ /* bit 1..5: IEEE_TRAP_ENABLE bits (see fpu.h) */ /* bit 6..8: UAC bits (see sysinfo.h) */ + /* bit 17..21: IEEE_STATUS_MASK bits (see fpu.h) */ unsigned long flags; /* perform syscall argument validation (get/set_fs) */ unsigned long fs; diff --git a/include/asm-i386/bugs.h b/include/asm-i386/bugs.h index 1f7b33910..a19ff035e 100644 --- a/include/asm-i386/bugs.h +++ b/include/asm-i386/bugs.h @@ -35,7 +35,7 @@ static void copro_timeout(void) fpu_error = 1; timer_table[COPRO_TIMER].expires = jiffies+100; timer_active |= 1<<COPRO_TIMER; - printk("387 failed: trying to reset\n"); + printk(KERN_ERR "387 failed: trying to reset\n"); send_sig(SIGFPE, last_task_used_math, 1); outb_p(0,0xf1); outb_p(0,0xf0); @@ -49,8 +49,8 @@ static void check_fpu(void) if (!hard_math) { #ifndef CONFIG_MATH_EMULATION - printk("No coprocessor found and no math emulation present.\n"); - printk("Giving up.\n"); + printk(KERN_EMERG "No coprocessor found and no math emulation present.\n"); + printk(KERN_EMERG "Giving up.\n"); for (;;) ; #endif return; @@ -64,7 +64,7 @@ static void check_fpu(void) * So the irq13 will happen eventually, but the exception 16 * should get there first.. */ - printk("Checking 386/387 coupling... "); + printk(KERN_INFO "Checking 386/387 coupling... "); timer_table[COPRO_TIMER].expires = jiffies+50; timer_table[COPRO_TIMER].fn = copro_timeout; timer_active |= 1<<COPRO_TIMER; @@ -101,7 +101,7 @@ static void check_fpu(void) static void check_hlt(void) { - printk("Checking 'hlt' instruction... "); + printk(KERN_INFO "Checking 'hlt' instruction... "); if (!hlt_works_ok) { printk("disabled\n"); return; @@ -118,7 +118,7 @@ static void check_tlb(void) * They will fault when they hit an invlpg instruction. */ if (x86 == 3) { - printk("CPU is a 386 and this kernel was compiled for 486 or better.\n"); + printk(KERN_EMERG "CPU is a 386 and this kernel was compiled for 486 or better.\n"); printk("Giving up.\n"); for (;;) ; } diff --git a/include/asm-i386/byteorder.h b/include/asm-i386/byteorder.h index 7dff2a869..ef55ae3ca 100644 --- a/include/asm-i386/byteorder.h +++ b/include/asm-i386/byteorder.h @@ -17,21 +17,6 @@ /* For avoiding bswap on i386 */ #ifdef __KERNEL__ #include <linux/config.h> - -/* - * In-kernel byte order macros to handle stuff like - * byte-order-dependent filesystems etc. - */ -#define cpu_to_le32(x) (x) -#define le32_to_cpu(x) (x) -#define cpu_to_le16(x) (x) -#define le16_to_cpu(x) (x) - -#define cpu_to_be32(x) htonl((x)) -#define be32_to_cpu(x) ntohl((x)) -#define cpu_to_be16(x) htons((x)) -#define be16_to_cpu(x) ntohs((x)) - #endif extern unsigned long int ntohl(unsigned long int); @@ -102,4 +87,68 @@ __ntohs(unsigned short int x) __htons((x))) #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); +} + +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); +} + +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 diff --git a/include/asm-i386/keyboard.h b/include/asm-i386/keyboard.h index 180d747e5..2ea9ce385 100644 --- a/include/asm-i386/keyboard.h +++ b/include/asm-i386/keyboard.h @@ -18,10 +18,6 @@ #define KEYBOARD_IRQ 1 #define DISABLE_KBD_DURING_INTERRUPTS 0 -#define KBD_REPORT_ERR -#define KBD_REPORT_UNKN -/* #define KBD_IS_FOCUS_9000 */ - extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode); extern int pckbd_getkeycode(unsigned int scancode); extern int pckbd_pretranslate(unsigned char scancode, char raw_mode); diff --git a/include/asm-i386/namei.h b/include/asm-i386/namei.h index c0dc3b3f8..981627be7 100644 --- a/include/asm-i386/namei.h +++ b/include/asm-i386/namei.h @@ -7,15 +7,12 @@ #ifndef __I386_NAMEI_H #define __I386_NAMEI_H -/* These dummy routines maybe changed to something useful +/* This dummy routine maybe changed to something useful * for /usr/gnemul/ emulation stuff. * Look at asm-sparc/namei.h for details. */ -#define translate_namei(pathname, base, follow_links, res_inode) \ - do { } while (0) - -#define translate_open_namei(pathname, flag, mode, res_inode, base) \ - do { } while (0) +#define __prefix_namei(retrieve_mode, name, base, buf, res_dir, res_inode, \ + last_name, last_entry, last_error) 1 #endif /* __I386_NAMEI_H */ diff --git a/include/asm-m68k/byteorder.h b/include/asm-m68k/byteorder.h index cbc560777..a5f0ce8bb 100644 --- a/include/asm-m68k/byteorder.h +++ b/include/asm-m68k/byteorder.h @@ -17,13 +17,6 @@ * byte-order-dependent filesystems etc. */ -#define le16_to_cpu(__val) __swab16(__val) -#define cpu_to_le16(__val) __swab16(__val) -#define le32_to_cpu(x) \ -(__builtin_constant_p(x) ? __constant_swab32(x) : __swab32(x)) -#define cpu_to_le32(x) \ -(__builtin_constant_p(x) ? __constant_swab32(x) : __swab32(x)) - extern __inline__ __u16 __swab16 (__u16 val) { return (val << 8) | (val >> 8); @@ -41,10 +34,63 @@ extern __inline__ __u32 __swab32 (__u32 val) return val; } -#define cpu_to_be32(x) (x) -#define be32_to_cpu(x) (x) -#define cpu_to_be16(x) (x) -#define be16_to_cpu(x) (x) +/* Convert from CPU byte order, to specified byte order. */ +#define cpu_to_le16(__val) __swab16(__val) +#define cpu_to_le32(__val) \ +(__builtin_constant_p(__val) ? __constant_swab32(__val) : __swab32(__val)) +#define cpu_to_be16(x) (x) +#define cpu_to_be32(x) (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); +} + +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. */ +extern __inline__ void cpu_to_le16s(__u16 *addr) +{ + *addr = cpu_to_le16(*addr); +} + +extern __inline__ void cpu_to_le32s(__u32 *addr) +{ + *addr = cpu_to_le32(*addr); +} + +#define cpu_to_be16s(x) do { } while (0) +#define cpu_to_be32s(x) do { } while (0) + +/* 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 diff --git a/include/asm-m68k/entry.h b/include/asm-m68k/entry.h new file mode 100644 index 000000000..6f907936a --- /dev/null +++ b/include/asm-m68k/entry.h @@ -0,0 +1,176 @@ +#ifndef __M68K_ENTRY_H +#define __M68K_ENTRY_H + +#include <linux/config.h> +#include <asm/setup.h> +#ifdef CONFIG_KGDB +#include <asm/kgdb.h> +#endif + +/* + * Stack layout in 'ret_from_exception': + * + * This allows access to the syscall arguments in registers d1-d5 + * + * 0(sp) - d1 + * 4(sp) - d2 + * 8(sp) - d3 + * C(sp) - d4 + * 10(sp) - d5 + * 14(sp) - a0 + * 18(sp) - a1 + * 1C(sp) - a2 + * 20(sp) - d0 + * 24(sp) - orig_d0 + * 28(sp) - stack adjustment + * 2C(sp) - sr + * 2E(sp) - pc + * 32(sp) - format & vector + */ + +/* + * 97/05/14 Andreas: Register %a2 is now set to the current task throughout + * the whole kernel. + */ + +#ifdef __ASSEMBLY__ + +#define curptr a2 + +/* + * these are offsets into the task-struct + */ +LTASK_STATE = 0 +LTASK_COUNTER = 4 +LTASK_PRIORITY = 8 +LTASK_SIGNAL = 12 +LTASK_BLOCKED = 16 +LTASK_FLAGS = 20 + +LTSS_KSP = 0 +LTSS_USP = 4 +LTSS_SR = 8 +LTSS_FS = 10 +LTSS_CRP = 12 +LTSS_FPCTXT = 24 + +/* the following macro is used when enabling interrupts */ +#if defined(MACH_ATARI_ONLY) + /* block out HSYNC on the atari */ +#define ALLOWINT 0xfbff +#define MAX_NOINT_IPL 3 +#else + /* portable version */ +#define ALLOWINT 0xf8ff +#define MAX_NOINT_IPL 0 +#endif /* machine compilation types */ + +LPT_OFF_D0 = 0x20 +LPT_OFF_ORIG_D0 = 0x24 +LPT_OFF_SR = 0x2C +LPT_OFF_FORMATVEC = 0x32 + +LFLUSH_I_AND_D = 0x00000808 +LENOSYS = 38 +LSIGTRAP = 5 + +LPF_TRACESYS_OFF = 3 +LPF_TRACESYS_BIT = 5 +LPF_PTRACED_OFF = 3 +LPF_PTRACED_BIT = 4 +LPF_DTRACE_OFF = 1 +LPF_DTRACE_BIT = 5 + +/* + * This defines the normal kernel pt-regs layout. + * + * regs a3-a6 and d6-d7 are preserved by C code + * the kernel doesn't mess with usp unless it needs to + */ +#ifndef CONFIG_KGDB +/* + * a -1 in the orig_d0 field signifies + * that the stack frame is NOT for syscall + */ +#define SAVE_ALL_INT \ + clrl %sp@-; /* stk_adj */ \ + pea -1:w; /* orig d0 */ \ + movel %d0,%sp@-; /* d0 */ \ + moveml %d1-%d5/%a0-%a1/%curptr,%sp@- + +#define SAVE_ALL_SYS \ + clrl %sp@-; /* stk_adj */ \ + movel %d0,%sp@-; /* orig d0 */ \ + movel %d0,%sp@-; /* d0 */ \ + moveml %d1-%d5/%a0-%a1/%curptr,%sp@- +#else +/* Need to save the "missing" registers for kgdb... + */ +#define SAVE_ALL_INT \ + clrl %sp@-; /* stk_adj */ \ + pea -1:w; /* orig d0 */ \ + movel %d0,%sp@-; /* d0 */ \ + moveml %d1-%d5/%a0-%a1/%curptr,%sp@-; \ + moveml %d6-%d7,kgdb_registers+GDBOFFA_D6; \ + moveml %a3-%a6,kgdb_registers+GDBOFFA_A3 + +#define SAVE_ALL_SYS \ + clrl %sp@-; /* stk_adj */ \ + movel %d0,%sp@-; /* orig d0 */ \ + movel %d0,%sp@-; /* d0 */ \ + moveml %d1-%d5/%a0-%a1/%curptr,%sp@-; \ + moveml %d6-%d7,kgdb_registers+GDBOFFA_D6; \ + moveml %a3-%a6,kgdb_registers+GDBOFFA_A3 +#endif + +#define RESTORE_ALL \ + moveml %sp@+,%a0-%a1/%curptr/%d1-%d5; \ + movel %sp@+,%d0; \ + addql #4,%sp; /* orig d0 */ \ + addl %sp@+,%sp; /* stk adj */ \ + rte + +#define SWITCH_STACK_SIZE (6*4+4) /* includes return address */ + +#define SAVE_SWITCH_STACK \ + moveml %a3-%a6/%d6-%d7,%sp@- + +#define RESTORE_SWITCH_STACK \ + moveml %sp@+,%a3-%a6/%d6-%d7 + +#define GET_CURRENT(tmp) \ + movel %sp,tmp; \ + andw &-8192,tmp; \ + movel tmp,%curptr; + +#else /* C source */ + +#define STR(X) STR1(X) +#define STR1(X) #X + +#define PT_OFF_ORIG_D0 0x24 +#define PT_OFF_FORMATVEC 0x32 +#define PT_OFF_SR 0x2C +#ifndef CONFIG_KGDB +#define SAVE_ALL_INT \ + "clrl %%sp@-;" /* stk_adj */ \ + "pea -1:w;" /* orig d0 = -1 */ \ + "movel %%d0,%%sp@-;" /* d0 */ \ + "moveml %%d1-%%d5/%%a0-%%a2,%%sp@-" +#else +#define SAVE_ALL_INT \ + "clrl %%sp@-\n\t" /* stk_adj */ \ + "pea -1:w\n\t" /* orig d0 = -1 */ \ + "movel %%d0,%%sp@-\n\t" /* d0 */ \ + "moveml %%d1-%%d5/%%a0-%%a2,%%sp@-\n\t" \ + "moveml %%d6-%%d7,kgdb_registers+"STR(GDBOFFA_D6)"\n\t" \ + "moveml %%a3-%%a6,kgdb_registers+"STR(GDBOFFA_A3) +#endif +#define GET_CURRENT(tmp) \ + "movel %%sp,"#tmp"\n\t" \ + "andw #-8192,"#tmp"\n\t" \ + "movel "#tmp",%%a2" + +#endif + +#endif /* __M68K_ENTRY_H */ diff --git a/include/asm-m68k/namei.h b/include/asm-m68k/namei.h index 13502e13e..4ecdd7ca7 100644 --- a/include/asm-m68k/namei.h +++ b/include/asm-m68k/namei.h @@ -7,15 +7,12 @@ #ifndef __M68K_NAMEI_H #define __M68K_NAMEI_H -/* These dummy routines maybe changed to something useful +/* This dummy routine maybe changed to something useful * for /usr/gnemul/ emulation stuff. * Look at asm-sparc/namei.h for details. */ -#define translate_namei(pathname, base, follow_links, res_inode) \ - do { } while (0) - -#define translate_open_namei(pathname, flag, mode, res_inode, base) \ - do { } while (0) +#define __prefix_namei(retrieve_mode, name, base, buf, res_dir, res_inode, \ + last_name, last_entry, last_error) 1 #endif diff --git a/include/asm-m68k/semaphore.h b/include/asm-m68k/semaphore.h index 7890c4f19..50aabc1c8 100644 --- a/include/asm-m68k/semaphore.h +++ b/include/asm-m68k/semaphore.h @@ -20,8 +20,8 @@ struct semaphore { struct wait_queue * wait; }; -#define MUTEX ((struct semaphore) { { 1 }, { 0 }, NULL }) -#define MUTEX_LOCKED ((struct semaphore) { { 0 }, { 0 }, NULL }) +#define MUTEX ((struct semaphore) { ATOMIC_INIT(1), ATOMIC_INIT(0), NULL }) +#define MUTEX_LOCKED ((struct semaphore) { ATOMIC_INIT(0), ATOMIC_INIT(0), NULL }) asmlinkage void __down_failed(void /* special register calling convention */); asmlinkage int __down_failed_interruptible(void /* params in registers */); @@ -73,7 +73,7 @@ static inline int waking_non_zero(struct semaphore *sem) * "down_failed" is a special asm handler that calls the C * routine that actually waits. See arch/m68k/lib/semaphore.S */ -extern inline void do_down(struct semaphore * sem, void (*failed)(void)) +extern inline void down(struct semaphore * sem) { register struct semaphore *sem1 __asm__ ("%a1") = sem; __asm__ __volatile__( @@ -84,15 +84,34 @@ extern inline void do_down(struct semaphore * sem, void (*failed)(void)) ".section .text.lock,\"ax\"\n" ".even\n" "2:\tpea 1b\n\t" - "jbra %1\n" + "jbra __down_failed\n" ".previous" : /* no outputs */ - : "a" (sem1), "m" (*(unsigned char *)failed) + : "a" (sem1) : "memory"); } -#define down(sem) do_down((sem),__down_failed) -#define down_interruptible(sem) do_down((sem),__down_failed_interruptible) +extern inline int down_interruptible(struct semaphore * sem) +{ + register struct semaphore *sem1 __asm__ ("%a1") = sem; + register int result __asm__ ("%d0"); + + __asm__ __volatile__( + "| atomic interruptible down operation\n\t" + "subql #1,%1@\n\t" + "jmi 2f\n\t" + "clrl %0\n" + "1:\n" + ".section .text.lock,\"ax\"\n" + ".even\n" + "2:\tpea 1b\n\t" + "jbra __down_failed_interruptible\n" + ".previous" + : "=d" (result) + : "a" (sem1) + : "%d0", "memory"); + return result; +} /* * Note! This is subtle. We jump to wake people up only if @@ -111,10 +130,10 @@ extern inline void up(struct semaphore * sem) ".section .text.lock,\"ax\"\n" ".even\n" "2:\tpea 1b\n\t" - "jbra %1\n" + "jbra __up_wakeup\n" ".previous" : /* no outputs */ - : "a" (sem1), "m" (*(unsigned char *)__up_wakeup) + : "a" (sem1) : "memory"); } diff --git a/include/asm-mips/byteorder.h b/include/asm-mips/byteorder.h index 92e3b8863..1263d9fe7 100644 --- a/include/asm-mips/byteorder.h +++ b/include/asm-mips/byteorder.h @@ -6,6 +6,8 @@ * for more details. * * Copyright (C) 1995, 1996, 1997 by Ralf Baechle + * + * $Id:$ */ #ifndef __ASM_MIPS_BYTEORDER_H #define __ASM_MIPS_BYTEORDER_H @@ -94,6 +96,60 @@ extern unsigned long int htonl(unsigned long int __x); #error "MIPS but neither __MIPSEL__ nor __MIPSEB__?" #endif +/* 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); +} + +extern __inline__ __u32 cpu_to_be32p(__u32 *addr) +{ + return cpu_to_be32(*addr); +} + +#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) + + +/* The same, but do the conversion in situ, ie. put the value back to addr. */ +extern __inline__ void cpu_to_le16s(__u16 *addr) +{ + *addr = cpu_to_le16(*addr); +} + +extern __inline__ void cpu_to_le32s(__u32 *addr) +{ + *addr = cpu_to_le32(*addr); +} + +extern __inline__ void cpu_to_be16s(__u16 *addr) +{ + *addr = cpu_to_be16(*addr); +} + +extern __inline__ void cpu_to_be32s(__u32 *addr) +{ + *addr = cpu_to_be32(*addr); +} + +#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) + + extern __inline__ unsigned long int ntohl(unsigned long int __x) { return __constant_ntohl(__x); diff --git a/include/asm-mips/namei.h b/include/asm-mips/namei.h index 8f3267eda..0ff96ac00 100644 --- a/include/asm-mips/namei.h +++ b/include/asm-mips/namei.h @@ -11,55 +11,43 @@ #ifdef CONFIG_BINFMT_IRIX /* Only one at this time. */ -#define IRIX32_EMUL "/usr/gnemul/irix" +#define IRIX32_EMUL "usr/gnemul/irix/" -#define translate_namei(pathname, base, follow_links, res_inode) ({ \ - if ((current->personality == PER_IRIX32) && !base && *pathname == '/') { \ - struct inode *emul_ino; \ - int namelen; \ - const char *name; \ - \ - while (*pathname == '/') \ - pathname++; \ - current->fs->root->i_count++; \ - if (dir_namei (IRIX32_EMUL, \ - &namelen, &name, current->fs->root, &emul_ino) >= 0 && emul_ino) { \ - *res_inode = NULL; \ - if (_namei (pathname, emul_ino, follow_links, res_inode) >= 0 && *res_inode) \ - return 0; \ - } \ - base = current->fs->root; \ - base->i_count++; \ - } \ -}) +extern int __namei(int, const char *, struct inode *, char *, struct inode **, + struct inode **, struct qstr *, struct dentry **, int *); -#define translate_open_namei(pathname, flag, mode, res_inode, base) ({ \ - if ((current->personality == PER_IRIX32) && !base && *pathname == '/') { \ - struct inode *emul_ino; \ - int namelen; \ - const char *name; \ - \ - while (*pathname == '/') \ - pathname++; \ - current->fs->root->i_count++; \ - if (dir_namei (IRIX32_EMUL, \ - &namelen, &name, current->fs->root, &emul_ino) >= 0 && emul_ino) { \ - *res_inode = NULL; \ - if (open_namei (pathname, flag, mode, res_inode, emul_ino) >= 0 && *res_inode) \ - return 0; \ - } \ - base = current->fs->root; \ - base->i_count++; \ - } \ -}) +static __inline__ int +__prefix_namei(int retrieve_mode, const char * name, struct inode * base, + char * buf, struct inode ** res_dir, struct inode ** res_inode, + struct qstr * last_name, struct dentry ** last_entry, + int * last_error) +{ + int error; -#else /* !defined(CONFIG_BINFMT_IRIX) */ + if (current->personality != PER_IRIX32) + return -EINVAL; + + while (*name == '/') + name++; + + atomic_inc(¤t->fs->root->i_count); + error = __namei(NAM_FOLLOW_LINK, IRIX32_EMUL, current->fs->root, + buf, NULL, &base, NULL, NULL, NULL); + if (error) + return error; -#define translate_namei(pathname, base, follow_links, res_inode) \ - do { } while (0) + error = __namei(retrieve_mode, name, base, buf, res_dir, res_inode, + last_name, last_entry, last_error); + if (error) + return error; + + return 0; +} + +#else /* !defined(CONFIG_BINFMT_IRIX) */ -#define translate_open_namei(pathname, flag, mode, res_inode, base) \ - do { } while (0) +#define __prefix_namei(retrieve_mode, name, base, buf, res_dir, res_inode, \ + last_name, last_entry, last_error) 1 #endif /* !defined(CONFIG_BINFMT_IRIX) */ diff --git a/include/asm-ppc/byteorder.h b/include/asm-ppc/byteorder.h index 0c771b2f4..bbb257941 100644 --- a/include/asm-ppc/byteorder.h +++ b/include/asm-ppc/byteorder.h @@ -19,38 +19,72 @@ #define __constant_htonl(x) ntohl(x) #define __constant_htons(x) ntohs(x) -/* - * In-kernel byte order macros to handle stuff like - * byte-order-dependent filesystems etc. - */ +#ifdef __KERNEL__ -#define cpu_to_le32(x) le32_to_cpu((x)) -extern __inline__ unsigned long le32_to_cpu(unsigned long x) +/* Convert from CPU byte order, to specified byte order. */ +extern __inline__ __u16 cpu_to_le16(__u16 value) { - return (((x & 0x000000ffU) << 24) | - ((x & 0x0000ff00U) << 8) | - ((x & 0x00ff0000U) >> 8) | - ((x & 0xff000000U) >> 24)); + return (value >> 8) | (value << 8); } +extern __inline__ __u32 cpu_to_le32(__u32 value) +{ + return((value>>24) | ((value>>8)&0xff00) | + ((value<<8)&0xff0000) | (value<<24)); +} +#define cpu_to_be16(x) (x) +#define cpu_to_be32(x) (x) -#define cpu_to_le16(x) le16_to_cpu((x)) -extern __inline__ unsigned short le16_to_cpu(unsigned short x) +/* The same, but returns converted value from the location pointer by addr. */ +extern __inline__ __u16 cpu_to_le16p(__u16 *addr) { - return (((x & 0x00ff) << 8) | - ((x & 0xff00) >> 8)); + return cpu_to_le16(*addr); } -#define cpu_to_be32(x) (x) -#define be32_to_cpu(x) (x) -#define cpu_to_be16(x) (x) -#define be16_to_cpu(x) (x) +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 /* !(_PPC_BYTEORDER_H) */ +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. */ +extern __inline__ void cpu_to_le16s(__u16 *addr) +{ + *addr = cpu_to_le16(*addr); +} +extern __inline__ void cpu_to_le32s(__u32 *addr) +{ + *addr = cpu_to_le32(*addr); +} + +#define cpu_to_be16s(x) do { } while (0) +#define cpu_to_be32s(x) do { } while (0) +/* 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 /* !(_PPC_BYTEORDER_H) */ diff --git a/include/asm-ppc/keyboard.h b/include/asm-ppc/keyboard.h index 6cd1391de..418476b2d 100644 --- a/include/asm-ppc/keyboard.h +++ b/include/asm-ppc/keyboard.h @@ -16,10 +16,6 @@ #define KEYBOARD_IRQ 1 #define DISABLE_KBD_DURING_INTERRUPTS 0 -#define KBD_REPORT_ERR -#define KBD_REPORT_UNKN -/* #define KBD_IS_FOCUS_9000 */ - extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode); extern int pckbd_getkeycode(unsigned int scancode); extern int pckbd_pretranslate(unsigned char scancode, char raw_mode); diff --git a/include/asm-sparc/byteorder.h b/include/asm-sparc/byteorder.h index 758324f39..5becb7c5d 100644 --- a/include/asm-sparc/byteorder.h +++ b/include/asm-sparc/byteorder.h @@ -1,4 +1,4 @@ -/* $Id: byteorder.h,v 1.13 1997/05/26 23:37:46 davem Exp $ */ +/* $Id: byteorder.h,v 1.14 1997/05/28 11:35:38 jj Exp $ */ #ifndef _SPARC_BYTEORDER_H #define _SPARC_BYTEORDER_H @@ -37,19 +37,56 @@ extern __inline__ __u32 cpu_to_le32(__u32 value) #define cpu_to_be16(x) (x) #define cpu_to_be32(x) (x) -/* Convert from specified byte order, to CPU byte order. */ -extern __inline__ __u16 le16_to_cpu(__u16 value) +/* The same, but returns converted value from the location pointer by addr. */ +extern __inline__ __u16 cpu_to_le16p(__u16 *addr) { - return (value >> 8) | (value << 8); + return cpu_to_le16(*addr); } -extern __inline__ __u32 le32_to_cpu(__u32 value) +extern __inline__ __u32 cpu_to_le32p(__u32 *addr) { - return((value>>24) | ((value>>8)&0xff00) | - ((value<<8)&0xff0000) | (value<<24)); + return cpu_to_le32(*addr); } -#define be16_to_cpu(x) (x) -#define be32_to_cpu(x) (x) + +extern __inline__ __u16 cpu_to_be16p(__u16 *addr) +{ + return cpu_to_be16(*addr); +} + +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. */ +extern __inline__ void cpu_to_le16s(__u16 *addr) +{ + *addr = cpu_to_le16(*addr); +} + +extern __inline__ void cpu_to_le32s(__u32 *addr) +{ + *addr = cpu_to_le32(*addr); +} + +#define cpu_to_be16s(x) do { } while (0) +#define cpu_to_be32s(x) do { } while (0) + +/* 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__ */ diff --git a/include/asm-sparc/namei.h b/include/asm-sparc/namei.h index b71537565..e74a76bce 100644 --- a/include/asm-sparc/namei.h +++ b/include/asm-sparc/namei.h @@ -1,4 +1,4 @@ -/* $Id: namei.h,v 1.3 1997/01/26 23:36:36 davem Exp $ +/* $Id: namei.h,v 1.5 1997/06/07 08:32:54 ecd Exp $ * linux/include/asm-sparc/namei.h * * Routines to handle famous /usr/gnemul/s*. @@ -11,44 +11,37 @@ #define SPARC_BSD_EMUL "usr/gnemul/sunos/" #define SPARC_SOL_EMUL "usr/gnemul/solaris/" -#define translate_namei(pathname, base, follow_links, res_inode) ({ \ - if ((current->personality & (PER_BSD|PER_SVR4)) && !base && *pathname == '/') { \ - struct inode *emul_ino; \ - int namelen; \ - const char *name; \ - \ - while (*pathname == '/') \ - pathname++; \ - current->fs->root->i_count++; \ - if (dir_namei (current->personality & PER_BSD ? SPARC_BSD_EMUL : SPARC_SOL_EMUL, \ - &namelen, &name, current->fs->root, &emul_ino) >= 0 && emul_ino) { \ - *res_inode = NULL; \ - if (_namei (pathname, emul_ino, follow_links, res_inode) >= 0 && *res_inode) \ - return 0; \ - } \ - base = current->fs->root; \ - base->i_count++; \ - } \ -}) - -#define translate_open_namei(pathname, flag, mode, res_inode, base) ({ \ - if ((current->personality & (PER_BSD|PER_SVR4)) && !base && *pathname == '/') { \ - struct inode *emul_ino; \ - int namelen; \ - const char *name; \ - \ - while (*pathname == '/') \ - pathname++; \ - current->fs->root->i_count++; \ - if (dir_namei (current->personality & PER_BSD ? SPARC_BSD_EMUL : SPARC_SOL_EMUL, \ - &namelen, &name, current->fs->root, &emul_ino) >= 0 && emul_ino) { \ - *res_inode = NULL; \ - if (open_namei (pathname, flag, mode, res_inode, emul_ino) >= 0 && *res_inode) \ - return 0; \ - } \ - base = current->fs->root; \ - base->i_count++; \ - } \ -}) +extern int __namei(int, const char *, struct inode *, char *, struct inode **, + struct inode **, struct qstr *, struct dentry **, int *); + +static __inline__ int +__prefix_namei(int retrieve_mode, const char * name, struct inode * base, + char * buf, struct inode ** res_dir, struct inode ** res_inode, + struct qstr * last_name, struct dentry ** last_entry, + int * last_error) +{ + int error; + + if (!(current->personality & (PER_BSD|PER_SVR4))) + return -ENOENT; + + while (*name == '/') + name++; + + atomic_inc(¤t->fs->root->i_count); + error = __namei(NAM_FOLLOW_LINK, + current->personality & PER_BSD ? + SPARC_BSD_EMUL : SPARC_SOL_EMUL, current->fs->root, + buf, NULL, &base, NULL, NULL, NULL); + if (error) + return error; + + error = __namei(retrieve_mode, name, base, buf, res_dir, res_inode, + last_name, last_entry, last_error); + if (error) + return error; + + return 0; +} #endif /* __SPARC_NAMEI_H */ diff --git a/include/asm-sparc/spinlock.h b/include/asm-sparc/spinlock.h index eb612dca4..c38b6af50 100644 --- a/include/asm-sparc/spinlock.h +++ b/include/asm-sparc/spinlock.h @@ -56,7 +56,7 @@ typedef struct { } rwlock_t; #include <asm/psr.h> /* Define this to use the verbose/debugging versions in arch/sparc/lib/debuglocks.c */ -#define SPIN_LOCK_DEBUG +/* #define SPIN_LOCK_DEBUG */ #ifdef SPIN_LOCK_DEBUG struct _spinlock_debug { diff --git a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h index b76772016..5060d88ae 100644 --- a/include/asm-sparc64/bitops.h +++ b/include/asm-sparc64/bitops.h @@ -1,4 +1,4 @@ -/* $Id: bitops.h,v 1.13 1997/05/27 06:47:16 davem Exp $ +/* $Id: bitops.h,v 1.16 1997/05/28 13:48:56 jj Exp $ * bitops.h: Bit string operations on the V9. * * Copyright 1996 David S. Miller (davem@caip.rutgers.edu) @@ -121,11 +121,33 @@ extern __inline__ unsigned long ffz(unsigned long word) : "0" (word) : "g1", "g2"); #else +#ifdef EASY_CHEESE_VERSION result = 0; while(word & 1) { result++; word >>= 1; } +#else + unsigned long tmp; + + result = 0; + tmp = ~word & -~word; + if (!(unsigned)tmp) { + tmp >>= 32; + result = 32; + } + if (!(unsigned short)tmp) { + tmp >>= 16; + result += 16; + } + if (!(unsigned char)tmp) { + tmp >>= 8; + result += 8; + } + if (tmp & 0xf0) result += 4; + if (tmp & 0xcc) result += 2; + if (tmp & 0xaa) result ++; +#endif #endif return result; } @@ -137,29 +159,31 @@ extern __inline__ unsigned long ffz(unsigned long word) extern __inline__ unsigned long find_next_zero_bit(void *addr, unsigned long size, unsigned long offset) { - unsigned long *p = ((unsigned long *) addr) + (offset >> 5); - unsigned long result = offset & ~31UL; + unsigned long *p = ((unsigned long *) addr) + (offset >> 6); + unsigned long result = offset & ~63UL; unsigned long tmp; if (offset >= size) return size; size -= result; - offset &= 31UL; + offset &= 63UL; if (offset) { tmp = *(p++); - tmp |= ~0UL >> (32-offset); - if (size < 32) + tmp |= ~0UL >> (64-offset); + if (size < 64) goto found_first; if (~tmp) goto found_middle; - size -= 32; - result += 32; + size -= 64; + result += 64; } - while (size & ~31UL) { + offset = size >> 6; + size &= 63UL; + while (offset) { if (~(tmp = *(p++))) goto found_middle; - result += 32; - size -= 32; + result += 64; + offset--; } if (!size) return result; @@ -248,9 +272,16 @@ extern __inline__ unsigned long __swab64(unsigned long value) ((value<<56) & 0xff00000000000000)); } +extern __inline__ unsigned long __swab64p(unsigned long *addr) +{ + unsigned long ret; + __asm__ __volatile__ ("ldxa [%1] %2, %0" : "=r" (ret) : "r" (addr), "i" (ASI_PL)); + return ret; +} + extern __inline__ unsigned long find_next_zero_le_bit(void *addr, unsigned long size, unsigned long offset) { - unsigned long *p = ((unsigned long *) addr) + (offset >> 5); + unsigned long *p = ((unsigned long *) addr) + (offset >> 6); unsigned long result = offset & ~63UL; unsigned long tmp; @@ -259,8 +290,8 @@ extern __inline__ unsigned long find_next_zero_le_bit(void *addr, unsigned long size -= result; offset &= 63UL; if(offset) { - tmp = *(p++); - tmp |= __swab64((~0UL >> (64-offset))); + tmp = __swab64p(p++); + tmp |= (~0UL >> (64-offset)); if(size < 64) goto found_first; if(~tmp) @@ -268,20 +299,21 @@ extern __inline__ unsigned long find_next_zero_le_bit(void *addr, unsigned long size -= 64; result += 64; } - while(size & ~63UL) { - if(~(tmp = *(p++))) + offset = size >> 6; + size &= 63UL; + while(offset) { + if(~(tmp = __swab64p(p++))) goto found_middle; result += 64; - size -= 64; + offset--; } if(!size) return result; - tmp = *p; - + tmp = __swab64p(p); found_first: - return result + ffz(__swab64(tmp) | (~0UL << size)); + tmp |= (~0UL << size); found_middle: - return result + ffz(__swab64(tmp)); + return result + ffz(tmp); } #ifdef __KERNEL__ diff --git a/include/asm-sparc64/byteorder.h b/include/asm-sparc64/byteorder.h index 21f4b0ba0..2325ef29c 100644 --- a/include/asm-sparc64/byteorder.h +++ b/include/asm-sparc64/byteorder.h @@ -1,7 +1,9 @@ -/* $Id: byteorder.h,v 1.4 1997/05/26 23:37:47 davem Exp $ */ +/* $Id: byteorder.h,v 1.5 1997/05/28 11:35:41 jj Exp $ */ #ifndef _SPARC64_BYTEORDER_H #define _SPARC64_BYTEORDER_H +#include <asm/asi.h> + #define ntohl(x) ((unsigned long int)(x)) #define ntohs(x) ((unsigned short int)(x)) #define htonl(x) ((unsigned long int)(x)) @@ -34,22 +36,87 @@ extern __inline__ __u32 cpu_to_le32(__u32 value) return((value>>24) | ((value>>8)&0xff00) | ((value<<8)&0xff0000) | (value<<24)); } + +extern __inline__ __u64 cpu_to_le64(__u64 value) +{ + return (((value>>56) & 0x00000000000000ffUL) | + ((value>>40) & 0x000000000000ff00UL) | + ((value>>24) & 0x0000000000ff0000UL) | + ((value>>8) & 0x00000000ff000000UL) | + ((value<<8) & 0x000000ff00000000UL) | + ((value<<24) & 0x0000ff0000000000UL) | + ((value<<40) & 0x00ff000000000000UL) | + ((value<<56) & 0xff00000000000000UL)); +} #define cpu_to_be16(x) (x) #define cpu_to_be32(x) (x) +#define cpu_to_be64(x) (x) -/* Convert from specified byte order, to CPU byte order. */ -extern __inline__ __u16 le16_to_cpu(__u16 value) +/* The same, but returns converted value from the location pointer by addr. */ +extern __inline__ __u16 cpu_to_le16p(__u16 *addr) { - return (value >> 8) | (value << 8); + __u16 ret; + __asm__ __volatile__ ("lduha [%1] %2, %0" : "=r" (ret) : "r" (addr), "i" (ASI_PL)); + return ret; } -extern __inline__ __u32 le32_to_cpu(__u32 value) +extern __inline__ __u32 cpu_to_le32p(__u32 *addr) { - return((value>>24) | ((value>>8)&0xff00) | - ((value<<8)&0xff0000) | (value<<24)); + __u32 ret; + __asm__ __volatile__ ("lduwa [%1] %2, %0" : "=r" (ret) : "r" (addr), "i" (ASI_PL)); + return ret; +} + +extern __inline__ __u64 cpu_to_le64p(__u64 *addr) +{ + __u64 ret; + __asm__ __volatile__ ("ldxa [%1] %2, %0" : "=r" (ret) : "r" (addr), "i" (ASI_PL)); + return ret; +} +extern __inline__ __u16 cpu_to_be16p(__u16 *addr) { return *addr; } +extern __inline__ __u32 cpu_to_be32p(__u32 *addr) { return *addr; } +extern __inline__ __u64 cpu_to_be64p(__u64 *addr) { return *addr; } + +/* The same, but do the conversion in situ, ie. put the value back to addr. */ +extern __inline__ void cpu_to_le16s(__u16 *addr) +{ + *addr = cpu_to_le16p(addr); +} + +extern __inline__ void cpu_to_le32s(__u32 *addr) +{ + *addr = cpu_to_le32p(addr); +} + +extern __inline__ void cpu_to_le64s(__u64 *addr) +{ + *addr = cpu_to_le64p(addr); } -#define be16_to_cpu(x) (x) -#define be32_to_cpu(x) (x) +#define cpu_to_be16s(x) do { } while (0) +#define cpu_to_be32s(x) do { } while (0) +#define cpu_to_be64s(x) do { } while (0) + +/* 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 le64_to_cpu(x) cpu_to_le64(x) +#define be16_to_cpu(x) cpu_to_be16(x) +#define be32_to_cpu(x) cpu_to_be32(x) +#define be64_to_cpu(x) cpu_to_be64(x) + +#define le16_to_cpup(x) cpu_to_le16p(x) +#define le32_to_cpup(x) cpu_to_le32p(x) +#define le64_to_cpup(x) cpu_to_le64p(x) +#define be16_to_cpup(x) cpu_to_be16p(x) +#define be32_to_cpup(x) cpu_to_be32p(x) +#define be64_to_cpup(x) cpu_to_be64p(x) + +#define le16_to_cpus(x) cpu_to_le16s(x) +#define le32_to_cpus(x) cpu_to_le32s(x) +#define le64_to_cpus(x) cpu_to_le64s(x) +#define be16_to_cpus(x) cpu_to_be16s(x) +#define be32_to_cpus(x) cpu_to_be32s(x) +#define be64_to_cpus(x) cpu_to_be64s(x) #endif /* __KERNEL__ */ diff --git a/include/asm-sparc64/checksum.h b/include/asm-sparc64/checksum.h index 63dbfec3d..d04abac7e 100644 --- a/include/asm-sparc64/checksum.h +++ b/include/asm-sparc64/checksum.h @@ -1,4 +1,4 @@ -/* $Id: checksum.h,v 1.7 1997/05/14 07:02:44 davem Exp $ */ +/* $Id: checksum.h,v 1.8 1997/05/29 12:45:03 jj Exp $ */ #ifndef __SPARC64_CHECKSUM_H #define __SPARC64_CHECKSUM_H @@ -41,7 +41,7 @@ extern unsigned int csum_partial(unsigned char * buff, int len, unsigned int sum #define csum_partial_copy(src, dst, len, sum) \ csum_partial_copy_nocheck(src,dst,len,sum) #define csum_partial_copy_fromuser(s, d, l, w) \ - csum_partial_copy((char *) (s), (d), (l), (w)) + csum_partial_copy_from_user((char *) (s), (d), (l), (w), NULL) extern __inline__ unsigned int csum_partial_copy_nocheck (const char *src, char *dst, int len, @@ -50,12 +50,13 @@ csum_partial_copy_nocheck (const char *src, char *dst, int len, register unsigned long ret asm("o0") = (unsigned long)src; register char *d asm("o1") = dst; register unsigned long l asm("g1") = len; - + __asm__ __volatile__ (" + wr %%g0, %5, %%asi call __csum_partial_copy_sparc_generic mov %4, %%g7 srl %%o0, 0, %%o0 - " : "=r" (ret) : "0" (ret), "r" (d), "r" (l), "r" (sum) : + " : "=r" (ret) : "0" (ret), "r" (d), "r" (l), "r" (sum), "i" (ASI_P) : "o1", "o2", "o3", "o4", "o5", "o7", "g1", "g2", "g3", "g5", "g7"); return (unsigned int)ret; } @@ -64,58 +65,35 @@ extern __inline__ unsigned int csum_partial_copy_from_user(const char *src, char *dst, int len, unsigned int sum, int *err) { - if (!access_ok (VERIFY_READ, src, len)) { - *err = -EFAULT; - memset (dst, 0, len); - return sum; - } else { - register unsigned long ret asm("o0") = (unsigned long)src; - register char *d asm("o1") = dst; - register unsigned long l asm("g1") = len; - register unsigned long s asm("g7") = sum; - - __asm__ __volatile__ (" - .section __ex_table,#alloc - .align 4 - .word 1f,2 - .previous + register unsigned long ret asm("o0") = (unsigned long)src; + register char *d asm("o1") = dst; + register unsigned long l asm("g1") = len; + register unsigned long s asm("g7") = sum; + + __asm__ __volatile__ (" + .section __ex_table,#alloc + .align 8 + .xword 1f,2 + .previous + wr %%g0, %6, %%asi 1: - call __csum_partial_copy_sparc_generic - stx %5, [%%sp + 0x7ff + 128] - srl %%o0, 0, %%o0 - " : "=r" (ret) : "0" (ret), "r" (d), "r" (l), "r" (s), "r" (err) : - "o1", "o2", "o3", "o4", "o5", "o7", "g1", "g2", "g3", "g5", "g7"); - return (unsigned int)ret; - } + call __csum_partial_copy_sparc_generic + stx %5, [%%sp + 0x7ff + 128] + srl %%o0, 0, %%o0 + " : "=r" (ret) : "0" (ret), "r" (d), "r" (l), "r" (s), "r" (err), "i" (ASI_S) : + "o1", "o2", "o3", "o4", "o5", "o7", "g1", "g2", "g3", "g5", "g7"); + return (unsigned int)ret; } - + +#if 0 +/* Not implemented, but nobody uses it yet... */ extern __inline__ unsigned int csum_partial_copy_to_user(const char *src, char *dst, int len, unsigned int sum, int *err) { - if (!access_ok (VERIFY_WRITE, dst, len)) { - *err = -EFAULT; - return sum; - } else { - register unsigned long ret asm("o0") = (unsigned long)src; - register char *d asm("o1") = dst; - register unsigned long l asm("g1") = len; - register unsigned long s asm("g7") = sum; - - __asm__ __volatile__ (" - .section __ex_table,#alloc - .align 4 - .word 1f,1 - .previous -1: - call __csum_partial_copy_sparc_generic - stx %5, [%%sp + 0x7ff + 128] - srl %%o0, 0, %%o0 - " : "=r" (ret) : "0" (ret), "r" (d), "r" (l), "r" (s), "r" (err) : - "o1", "o2", "o3", "o4", "o5", "o7", "g1", "g2", "g3", "g5", "g7"); - return (unsigned int)ret; - } + return 0; } +#endif /* ihl is always 5 or greater, almost always is 5, and iph is word aligned * the majority of the time. diff --git a/include/asm-sparc64/fpumacro.h b/include/asm-sparc64/fpumacro.h index 9928a38c2..f6323254d 100644 --- a/include/asm-sparc64/fpumacro.h +++ b/include/asm-sparc64/fpumacro.h @@ -1,12 +1,27 @@ /* fpumacro.h: FPU related macros. * * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) + * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) */ #ifndef _SPARC64_FPUMACRO_H #define _SPARC64_FPUMACRO_H -extern __inline__ void fpsave32(unsigned long *fpregs, unsigned long *fsr) +extern __inline__ unsigned long fprs_read(void) +{ + unsigned long retval; + + __asm__ __volatile__("rd %%fprs, %0" : "=r" (retval)); + + return retval; +} + +extern __inline__ void fprs_write(unsigned long val) +{ + __asm__ __volatile__("wr %0, 0x0, %%fprs" : : "r" (val)); +} + +extern __inline__ void fpsave32(unsigned int *fpregs, unsigned long *fsr) { __asm__ __volatile__ (" wr %%g0, %2, %%asi @@ -16,7 +31,7 @@ extern __inline__ void fpsave32(unsigned long *fpregs, unsigned long *fsr) " : : "r" (fpregs), "r" (fsr), "i" (ASI_BLK_P)); } -extern __inline__ void fpload32(unsigned long *fpregs, unsigned long *fsr) +extern __inline__ void fpload32(unsigned int *fpregs, unsigned long *fsr) { __asm__ __volatile__ (" wr %%g0, %2, %%asi @@ -26,7 +41,27 @@ extern __inline__ void fpload32(unsigned long *fpregs, unsigned long *fsr) " : : "r" (fpregs), "r" (fsr), "i" (ASI_BLK_P)); } -extern __inline__ void fpsave(unsigned long *fpregs, unsigned long *fsr) +extern __inline__ void fpsave64hi(unsigned int *fpregs, unsigned long *fsr) +{ + __asm__ __volatile__ (" + wr %%g0, %2, %%asi + stx %%fsr, [%1] + stda %%f32, [%0 + 128] %%asi + stda %%f48, [%0 + 192] %%asi + " : : "r" (fpregs), "r" (fsr), "i" (ASI_BLK_P)); +} + +extern __inline__ void fpload64hi(unsigned int *fpregs, unsigned long *fsr) +{ + __asm__ __volatile__ (" + wr %%g0, %2, %%asi + ldda [%0 + 128] %%asi, %%f32 + ldda [%0 + 192] %%asi, %%f48 + ldx [%1], %%fsr + " : : "r" (fpregs), "r" (fsr), "i" (ASI_BLK_P)); +} + +extern __inline__ void fpsave(unsigned int *fpregs, unsigned long *fsr) { __asm__ __volatile__ (" wr %%g0, %2, %%asi @@ -38,7 +73,7 @@ extern __inline__ void fpsave(unsigned long *fpregs, unsigned long *fsr) " : : "r" (fpregs), "r" (fsr), "i" (ASI_BLK_P)); } -extern __inline__ void fpload(unsigned long *fpregs, unsigned long *fsr) +extern __inline__ void fpload(unsigned int *fpregs, unsigned long *fsr) { __asm__ __volatile__ (" wr %%g0, %2, %%asi diff --git a/include/asm-sparc64/head.h b/include/asm-sparc64/head.h index 7127ca74c..62fe9a08f 100644 --- a/include/asm-sparc64/head.h +++ b/include/asm-sparc64/head.h @@ -1,4 +1,4 @@ -/* $Id: head.h,v 1.21 1997/05/27 06:28:17 davem Exp $ */ +/* $Id: head.h,v 1.22 1997/06/02 06:33:40 davem Exp $ */ #ifndef _SPARC64_HEAD_H #define _SPARC64_HEAD_H @@ -9,12 +9,13 @@ /* We need a "cleaned" instruction... */ #define CLEAN_WINDOW \ + rdpr %cleanwin, %l0; add %l0, 1, %l0; \ + wrpr %l0, 0x0, %cleanwin; \ clr %o0; clr %o1; clr %o2; clr %o3; \ clr %o4; clr %o5; clr %o6; clr %o7; \ clr %l0; clr %l1; clr %l2; clr %l3; \ clr %l4; clr %l5; clr %l6; clr %l7; \ - rdpr %cleanwin, %g1; add %g1, 1, %g1; \ - wrpr %g1, 0x0, %cleanwin; retry; \ + retry; \ nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop;nop; #define TRAP(routine) \ @@ -23,7 +24,7 @@ call routine; \ add %sp, STACK_BIAS + REGWIN_SZ, %o0; \ ba,pt %xcc, rtrap; \ - nop; \ + clr %l6; \ nop; \ nop; @@ -38,7 +39,7 @@ call routine; \ add %sp, STACK_BIAS + REGWIN_SZ, %o0; \ ba,pt %xcc, rtrap; \ - nop; \ + clr %l6; \ nop; \ nop; @@ -60,7 +61,7 @@ call routine; \ mov arg, %o1; \ ba,pt %xcc, rtrap; \ - nop; \ + clr %l6; \ nop; #define TRAPTL1_ARG(routine, arg) \ @@ -70,7 +71,7 @@ call routine; \ mov arg, %o1; \ ba,pt %xcc, rtrap; \ - nop; \ + clr %l6; \ nop; #define SYSCALL_TRAP(routine, systbl) \ @@ -89,7 +90,7 @@ call routine; \ add %sp, STACK_BIAS + REGWIN_SZ, %o0; \ ba,pt %xcc, rtrap; \ - nop; + clr %l6; #define ACCESS_EXCEPTION_TRAPTL1(routine) \ rdpr %pstate, %g1; \ @@ -99,7 +100,7 @@ call routine; \ add %sp, STACK_BIAS + REGWIN_SZ, %o0; \ ba,pt %xcc, rtrap; \ - nop; + clr %l6; #define SUNOS_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall, sunos_sys_table) #define LINUX_32BIT_SYSCALL_TRAP SYSCALL_TRAP(linux_sparc_syscall, sys_call_table32) @@ -120,7 +121,7 @@ mov level, %o0; \ call routine; \ add %sp, STACK_BIAS + REGWIN_SZ, %o1; \ - ba,a,pt %xcc, rtrap; + ba,a,pt %xcc, rtrap_clr_l6; /* On UP this is ok, and worth the effort, for SMP we need * a different mechanism and thus cannot do it all in trap table. -DaveM @@ -150,7 +151,7 @@ ldx [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_TNPC], %l1; \ add %l1, 4, %l2; \ stx %l1, [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_TPC]; \ - ba,pt %xcc, rtrap; \ + ba,pt %xcc, rtrap_clr_l6; \ stx %l2, [%sp + STACK_BIAS + REGWIN_SZ + PT_V9_TNPC]; /* Before touching these macros, you owe it to yourself to go and @@ -198,7 +199,8 @@ stxa %i6, [%sp + STACK_BIAS + 0x70] %asi; \ stxa %i7, [%sp + STACK_BIAS + 0x78] %asi; \ saved; retry; nop; nop; nop; nop; nop; nop; \ - nop; nop; nop; nop; nop; nop; \ + nop; nop; nop; nop; nop; \ + b,a,pt %xcc, spill_fixup_mna; \ b,a,pt %xcc, spill_fixup; /* Normal 32bit spill */ @@ -215,7 +217,8 @@ stda %i6, [%sp + 0x38] %asi; \ saved; retry; nop; nop; nop; nop; \ nop; nop; nop; nop; nop; nop; nop; nop; \ - nop; nop; nop; nop; nop; nop; nop; \ + nop; nop; nop; nop; nop; nop; \ + b,a,pt %xcc, spill_fixup_mna; \ b,a,pt %xcc, spill_fixup; #define SPILL_1_NORMAL SPILL_1_GENERIC(ASI_AIUP) @@ -276,7 +279,8 @@ ldxa [%sp + STACK_BIAS + 0x70] %asi, %i6; \ ldxa [%sp + STACK_BIAS + 0x78] %asi, %i7; \ restored; retry; nop; nop; nop; nop; nop; nop; \ - nop; nop; nop; nop; nop; nop; \ + nop; nop; nop; nop; nop; \ + b,a,pt %xcc, fill_fixup_mna; \ b,a,pt %xcc, fill_fixup; /* Normal 32bit fill */ @@ -293,7 +297,8 @@ ldda [%sp + 0x38] %asi, %i6; \ restored; retry; nop; nop; nop; nop; \ nop; nop; nop; nop; nop; nop; nop; nop; \ - nop; nop; nop; nop; nop; nop; nop; \ + nop; nop; nop; nop; nop; nop; \ + b,a,pt %xcc, fill_fixup_mna; \ b,a,pt %xcc, fill_fixup; #define FILL_1_NORMAL FILL_1_GENERIC(ASI_AIUP) diff --git a/include/asm-sparc64/namei.h b/include/asm-sparc64/namei.h index f8fdbb533..af5afb721 100644 --- a/include/asm-sparc64/namei.h +++ b/include/asm-sparc64/namei.h @@ -1,4 +1,4 @@ -/* $Id: namei.h,v 1.2 1997/03/19 17:28:27 jj Exp $ +/* $Id: namei.h,v 1.4 1997/06/07 08:32:56 ecd Exp $ * linux/include/asm-sparc64/namei.h * * Routines to handle famous /usr/gnemul/s*. @@ -11,44 +11,37 @@ #define SPARC_BSD_EMUL "usr/gnemul/sunos/" #define SPARC_SOL_EMUL "usr/gnemul/solaris/" -#define translate_namei(pathname, base, follow_links, res_inode) ({ \ - if ((current->personality & (PER_BSD|PER_SVR4)) && !base && *pathname == '/') { \ - struct inode *emul_ino; \ - int namelen; \ - const char *name; \ - \ - while (*pathname == '/') \ - pathname++; \ - current->fs->root->i_count++; \ - if (dir_namei (current->personality & PER_BSD ? SPARC_BSD_EMUL : SPARC_SOL_EMUL, \ - &namelen, &name, current->fs->root, &emul_ino) >= 0 && emul_ino) { \ - *res_inode = NULL; \ - if (_namei (pathname, emul_ino, follow_links, res_inode) >= 0 && *res_inode) \ - return 0; \ - } \ - base = current->fs->root; \ - base->i_count++; \ - } \ -}) - -#define translate_open_namei(pathname, flag, mode, res_inode, base) ({ \ - if ((current->personality & (PER_BSD|PER_SVR4)) && !base && *pathname == '/') { \ - struct inode *emul_ino; \ - int namelen; \ - const char *name; \ - \ - while (*pathname == '/') \ - pathname++; \ - current->fs->root->i_count++; \ - if (dir_namei (current->personality & PER_BSD ? SPARC_BSD_EMUL : SPARC_SOL_EMUL, \ - &namelen, &name, current->fs->root, &emul_ino) >= 0 && emul_ino) { \ - *res_inode = NULL; \ - if (open_namei (pathname, flag, mode, res_inode, emul_ino) >= 0 && *res_inode) \ - return 0; \ - } \ - base = current->fs->root; \ - base->i_count++; \ - } \ -}) +extern int __namei(int, const char *, struct inode *, char *, struct inode **, + struct inode **, struct qstr *, struct dentry **, int *); + +static inline int +__prefix_namei(int retrieve_mode, const char * name, struct inode * base, + char * buf, struct inode ** res_dir, struct inode ** res_inode, + struct qstr * last_name, struct dentry ** last_entry, + int * last_error) +{ + int error; + + if (!(current->personality & (PER_BSD|PER_SVR4))) + return -ENOENT; + + while (*name == '/') + name++; + + atomic_inc(¤t->fs->root->i_count); + error = __namei(NAM_FOLLOW_LINK, + current->personality & PER_BSD ? + SPARC_BSD_EMUL : SPARC_SOL_EMUL, current->fs->root, + buf, NULL, &base, NULL, NULL, NULL); + if (error) + return error; + + error = __namei(retrieve_mode, name, base, buf, res_dir, res_inode, + last_name, last_entry, last_error); + if (error) + return error; + + return 0; +} #endif /* __SPARC64_NAMEI_H */ diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h index a739cea5e..e56a4024d 100644 --- a/include/asm-sparc64/pgtable.h +++ b/include/asm-sparc64/pgtable.h @@ -1,4 +1,4 @@ -/* $Id: pgtable.h,v 1.32 1997/05/26 23:39:20 davem Exp $ +/* $Id: pgtable.h,v 1.34 1997/06/02 06:33:41 davem Exp $ * pgtable.h: SpitFire page table operations. * * Copyright 1996,1997 David S. Miller (davem@caip.rutgers.edu) @@ -160,45 +160,6 @@ extern void *sparc_init_alloc(unsigned long *kbrk, unsigned long size); /* Cache and TLB flush operations. */ -/* This is a bit tricky to do most efficiently. The I-CACHE on the - * SpitFire will snoop stores from _other_ processors and changes done - * by DMA, but it does _not_ snoop stores on the local processor. - * Also, even if the I-CACHE snoops the store from someone else correctly, - * you can still lose if the instructions are in the pipeline already. - * A big issue is that this cache is only 16K in size, using a pseudo - * 2-set associative scheme. A full flush of the cache is far too much - * for me to accept, especially since most of the time when we get to - * running this code the icache data we want to flush is not even in - * the cache. Thus the following seems to be the best method. - */ -extern __inline__ void spitfire_flush_icache_page(unsigned long page) -{ - unsigned long temp; - - /* Commit all potential local stores to the instruction space - * on this processor before the flush. - */ - membar("#StoreStore"); - - /* Actually perform the flush. */ - __asm__ __volatile__(" -1: - flush %0 + 0x00 - flush %0 + 0x08 - flush %0 + 0x10 - flush %0 + 0x18 - flush %0 + 0x20 - flush %0 + 0x28 - flush %0 + 0x30 - flush %0 + 0x38 - subcc %1, 0x40, %1 - bge,pt %%icc, 1b - add %2, %1, %0 -" : "=&r" (page), "=&r" (temp) - : "r" (page), "0" (page + PAGE_SIZE - 0x40), "1" (PAGE_SIZE - 0x40) - : "cc"); -} - extern __inline__ void flush_cache_all(void) { unsigned long addr; @@ -283,13 +244,14 @@ extern __inline__ void flush_tlb_mm(struct mm_struct *mm) 1: stxa %%g0, [%%g3] %3 stxa %%g0, [%%g3] %4 - bne,a,pn %%icc, 1f - stxa %%g2, [%%g7] %2 + be,a,pt %%icc, 1f + nop + stxa %%g2, [%%g7] %2 1: flush %%g4 wrpr %%g1, 0x0, %%pil " : /* no outputs */ - : "r" (mm->context), "i" (SECONDARY_CONTEXT), "i" (ASI_DMMU), + : "r" (mm->context & 0x1fff), "i" (SECONDARY_CONTEXT), "i" (ASI_DMMU), "i" (ASI_DMMU_DEMAP), "i" (ASI_IMMU_DEMAP) : "g1", "g2", "g3", "g7", "cc"); } @@ -300,7 +262,7 @@ extern __inline__ void flush_tlb_range(struct mm_struct *mm, unsigned long start { if(mm->context != NO_CONTEXT) { unsigned long old_ctx = spitfire_get_secondary_context(); - unsigned long new_ctx = mm->context; + unsigned long new_ctx = (mm->context & 0x1fff); unsigned long flags; start &= PAGE_MASK; @@ -332,22 +294,20 @@ extern __inline__ void flush_tlb_page(struct vm_area_struct *vma, unsigned long ldxa [%%g7] %2, %%g2 cmp %%g2, %0 be,pt %%icc, 1f - or %5, 0x10, %5 + or %5, 0x10, %%g3 stxa %0, [%%g7] %2 1: - stxa %%g0, [%5] %3 - brnz,a %6, 1f - stxa %%g0, [%5] %4 -1: - bne,a,pn %%icc, 1f - stxa %%g2, [%%g7] %2 + stxa %%g0, [%%g3] %3 + stxa %%g0, [%%g3] %4 + be,a,pt %%icc, 1f + nop + stxa %%g2, [%%g7] %2 1: flush %%g4 wrpr %%g1, 0x0, %%pil " : /* no outputs */ - : "r" (mm->context), "i" (SECONDARY_CONTEXT), "i" (ASI_DMMU), - "i" (ASI_DMMU_DEMAP), "i" (ASI_IMMU_DEMAP), "r" (page & PAGE_MASK), - "r" (vma->vm_flags & VM_EXEC) + : "r" (mm->context & 0x1fff), "i" (SECONDARY_CONTEXT), "i" (ASI_DMMU), + "i" (ASI_DMMU_DEMAP), "i" (ASI_IMMU_DEMAP), "r" (page & PAGE_MASK) : "g1", "g2", "g3", "g7", "cc"); } } diff --git a/include/asm-sparc64/psrcompat.h b/include/asm-sparc64/psrcompat.h index dccc4f69a..b971514d6 100644 --- a/include/asm-sparc64/psrcompat.h +++ b/include/asm-sparc64/psrcompat.h @@ -1,4 +1,4 @@ -/* $Id: psrcompat.h,v 1.2 1997/04/07 18:57:17 jj Exp $ */ +/* $Id: psrcompat.h,v 1.3 1997/06/05 06:22:54 davem Exp $ */ #ifndef _SPARC64_PSRCOMPAT_H #define _SPARC64_PSRCOMPAT_H @@ -47,7 +47,7 @@ extern inline unsigned long psr_to_tstate_icc(unsigned int psr) { unsigned long tstate; - tstate = (psr & PSR_ICC) << 12; + tstate = ((unsigned long)(psr & PSR_ICC)) << 12; return tstate; } diff --git a/include/asm-sparc64/pstate.h b/include/asm-sparc64/pstate.h index 490d837a8..2233ee7f0 100644 --- a/include/asm-sparc64/pstate.h +++ b/include/asm-sparc64/pstate.h @@ -1,4 +1,4 @@ -/* $Id: pstate.h,v 1.3 1997/03/25 03:58:31 davem Exp $ */ +/* $Id: pstate.h,v 1.4 1997/05/29 12:45:02 jj Exp $ */ #ifndef _SPARC64_PSTATE_H #define _SPARC64_PSTATE_H @@ -79,4 +79,32 @@ #define VERS_MAXTL 0x000000000000ff00 /* Maximum Trap Level. */ #define VERS_MAXWIN 0x000000000000001f /* Maximum Reg Window Index. */ +#if defined(__KERNEL__) && !defined(__ASSEMBLY__) +#define set_pstate(bits) \ + __asm__ __volatile__( \ + "rdpr %%pstate, %%g1\n\t" \ + "or %%g1, %0, %%g1\n\t" \ + "wrpr %%g1, 0x0, %%pstate\n\t" \ + : /* no outputs */ \ + : "i" (bits) \ + : "g1") + +#define clear_pstate(bits) \ + __asm__ __volatile__( \ + "rdpr %%pstate, %%g1\n\t" \ + "andn %%g1, %0, %%g1\n\t" \ + "wrpr %%g1, 0x0, %%pstate\n\t" \ + : /* no outputs */ \ + : "i" (bits) \ + : "g1") + +#define change_pstate(bits) \ + __asm__ __volatile__( \ + "rdpr %%pstate, %%g1\n\t" \ + "wrpr %%g1, %0, %%pstate\n\t" \ + : /* no outputs */ \ + : "i" (bits) \ + : "g1") +#endif + #endif /* !(_SPARC64_PSTATE_H) */ diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h index 786cfd2af..d0d88fa5c 100644 --- a/include/asm-sparc64/system.h +++ b/include/asm-sparc64/system.h @@ -1,4 +1,4 @@ -/* $Id: system.h,v 1.19 1997/05/18 22:52:32 davem Exp $ */ +/* $Id: system.h,v 1.22 1997/06/01 10:27:28 davem Exp $ */ #ifndef __SPARC64_SYSTEM_H #define __SPARC64_SYSTEM_H @@ -114,16 +114,24 @@ extern __inline__ void flushw_user(void) #define flush_user_windows flushw_user #ifdef __SMP__ -#error SMP not supported on sparc64 + +#include <asm/fpumacro.h> + +#define SWITCH_ENTER(prev) \ + if((prev)->flags & PF_USEDFPU) { \ + fprs_write(FPRS_FEF); \ + fpsave((unsigned long *) &(prev)->tss.float_regs[0], \ + &(prev)->tss.fsr); \ + (prev)->flags &= ~PF_USEDFPU; \ + (prev)->tss.kregs->tstate &= ~TSTATE_PEF; \ + } + +#define SWITCH_DO_LAZY_FPU(next) #else -#if 0 +#define SWITCH_ENTER(prev) #define SWITCH_DO_LAZY_FPU(next) \ if(last_task_used_math != (next)) \ - (next)->tss.kregs->tstate&=~TSTATE_PEF -#else -/* XXX FIX ME BIG TIME XXX -DaveM */ -#define SWITCH_DO_LAZY_FPU(next) do { } while(0) -#endif + (next)->tss.kregs->tstate &= ~TSTATE_PEF #endif /* See what happens when you design the chip correctly? @@ -138,29 +146,33 @@ extern __inline__ void flushw_user(void) do { \ __label__ switch_continue; \ register unsigned long task_pc asm("o7"); \ + SWITCH_ENTER(prev) \ SWITCH_DO_LAZY_FPU(next); \ task_pc = ((unsigned long) &&switch_continue) - 0x8; \ __asm__ __volatile__( \ + "rdpr %%pstate, %%g2\n\t" \ + "wrpr %%g2, 0x2, %%pstate\n\t" \ "flushw\n\t" \ "stx %%i6, [%%sp + 2047 + 0x70]\n\t" \ "stx %%i7, [%%sp + 2047 + 0x78]\n\t" \ - "stx %%o6, [%%g6 + %3]\n\t" \ "rdpr %%wstate, %%o5\n\t" \ - "stx %%o7, [%%g6 + %4]\n\t" \ + "stx %%o6, [%%g6 + %3]\n\t" \ "stx %%o5, [%%g6 + %2]\n\t" \ "rdpr %%cwp, %%o5\n\t" \ + "stx %%o7, [%%g6 + %4]\n\t" \ "stx %%o5, [%%g6 + %5]\n\t" \ "mov %0, %%g6\n\t" \ + "ldx [%0 + %5], %%g1\n\t" \ "wr %0, 0x0, %%pic\n\t" \ - "ldx [%%g6 + %5], %%g1\n\t" \ "wrpr %%g1, %%cwp\n\t" \ "ldx [%%g6 + %2], %%o5\n\t" \ "ldx [%%g6 + %3], %%o6\n\t" \ "ldx [%%g6 + %4], %%o7\n\t" \ "wrpr %%o5, 0x0, %%wstate\n\t" \ "ldx [%%sp + 2047 + 0x70], %%i6\n\t" \ + "ldx [%%sp + 2047 + 0x78], %%i7\n\t" \ "jmpl %%o7 + 0x8, %%g0\n\t" \ - " ldx [%%sp + 2047 + 0x78], %%i7\n\t" \ + " wrpr %%g2, 0x0, %%pstate\n\t" \ : /* No outputs */ \ : "r" (next), "r" (task_pc), \ "i" ((const unsigned long)(&((struct task_struct *)0)->tss.wstate)), \ diff --git a/include/asm-sparc64/uaccess.h b/include/asm-sparc64/uaccess.h index 93320f335..40ad3ee21 100644 --- a/include/asm-sparc64/uaccess.h +++ b/include/asm-sparc64/uaccess.h @@ -1,4 +1,4 @@ -/* $Id: uaccess.h,v 1.12 1997/04/10 23:32:50 davem Exp $ */ +/* $Id: uaccess.h,v 1.13 1997/05/29 12:45:04 jj Exp $ */ #ifndef _ASM_UACCESS_H #define _ASM_UACCESS_H @@ -151,8 +151,8 @@ __asm__ __volatile__( \ " mov %3, %0\n\n\t" \ ".previous\n\t" \ ".section __ex_table,#alloc\n\t" \ - ".align 4\n\t" \ - ".word 1b, 3b\n\t" \ + ".align 8\n\t" \ + ".xword 1b, 3b\n\t" \ ".previous\n\n\t" \ : "=r" (ret) : "r" (x), "r" (__m(addr)), \ "i" (-EFAULT), "i" (ASI_S)) @@ -163,8 +163,8 @@ __asm__ __volatile__( \ "/* Put user asm ret, inline. */\n" \ "1:\t" "st"#size "a %1, [%2] %3\n\n\t" \ ".section __ex_table,#alloc\n\t" \ - ".align 4\n\t" \ - ".word 1b, __ret_efault\n\n\t" \ + ".align 8\n\t" \ + ".xword 1b, __ret_efault\n\n\t" \ ".previous\n\n\t" \ : "=r" (foo) : "r" (x), "r" (__m(addr)), "i" (ASI_S)); \ else \ @@ -178,8 +178,8 @@ __asm__ __volatile( \ " restore %%g0, %3, %%o0\n\n\t" \ ".previous\n\t" \ ".section __ex_table,#alloc\n\t" \ - ".align 4\n\t" \ - ".word 1b, 3b\n\n\t" \ + ".align 8\n\t" \ + ".xword 1b, 3b\n\n\t" \ ".previous\n\n\t" \ : "=r" (foo) : "r" (x), "r" (__m(addr)), \ "i" (ret), "i" (ASI_S)) @@ -221,8 +221,8 @@ __asm__ __volatile__( \ " mov %3, %0\n\n\t" \ ".previous\n\t" \ ".section __ex_table,#alloc\n\t" \ - ".align 4\n\t" \ - ".word 1b, 3b\n\n\t" \ + ".align 8\n\t" \ + ".xword 1b, 3b\n\n\t" \ ".previous\n\t" \ : "=r" (ret), "=r" (x) : "r" (__m(addr)), \ "i" (-EFAULT), "i" (ASI_S)) @@ -233,8 +233,8 @@ __asm__ __volatile__( \ "/* Get user asm ret, inline. */\n" \ "1:\t" "ld"#size "a [%1] %2, %0\n\n\t" \ ".section __ex_table,#alloc\n\t" \ - ".align 4\n\t" \ - ".word 1b,__ret_efault\n\n\t" \ + ".align 8\n\t" \ + ".xword 1b,__ret_efault\n\n\t" \ ".previous\n\t" \ : "=r" (x) : "r" (__m(addr)), "i" (ASI_S)); \ else \ @@ -248,8 +248,8 @@ __asm__ __volatile__( \ " restore %%g0, %3, %%o0\n\n\t" \ ".previous\n\t" \ ".section __ex_table,#alloc\n\t" \ - ".align 4\n\t" \ - ".word 1b, 3b\n\n\t" \ + ".align 8\n\t" \ + ".xword 1b, 3b\n\n\t" \ ".previous\n\t" \ : "=r" (x) : "r" (__m(addr)), "i" (retval), "i" (ASI_S)) @@ -291,8 +291,8 @@ extern __inline__ __kernel_size_t __clear_user(void *addr, __kernel_size_t size) __kernel_size_t ret; __asm__ __volatile__ (" .section __ex_table,#alloc - .align 4 - .word 1f,3 + .align 8 + .xword 1f,3 .previous 1: wr %%g0, %3, %%asi diff --git a/include/asm-sparc64/vuid_event.h b/include/asm-sparc64/vuid_event.h index 0c5977fab..9ef4d17ad 100644 --- a/include/asm-sparc64/vuid_event.h +++ b/include/asm-sparc64/vuid_event.h @@ -5,8 +5,6 @@ typedef struct firm_event { unsigned char pair_type; /* unused by X11 */ unsigned char pair; /* unused by X11 */ int value; /* VKEY_UP, VKEY_DOWN or delta */ - - /* XXX Timeval could hose old 32-bit programs, investigate and fixme XXX */ struct timeval time; } Firm_event; diff --git a/include/linux/affs_fs.h b/include/linux/affs_fs.h index fc7c46dc8..cfb891c4e 100644 --- a/include/linux/affs_fs.h +++ b/include/linux/affs_fs.h @@ -69,8 +69,7 @@ extern int affs_link(struct inode *oldinode, struct inode *dir, extern int affs_symlink(struct inode *dir, const char *name, int len, const char *symname); extern int affs_rename(struct inode *old_dir, const char *old_name, int old_len, - struct inode *new_dir, const char *new_name, int new_len, - int must_be_dir); + struct inode *new_dir, const char *new_name, int new_len); /* inode.c */ diff --git a/include/linux/atalk.h b/include/linux/atalk.h index 2e4de841c..70e691251 100644 --- a/include/linux/atalk.h +++ b/include/linux/atalk.h @@ -17,6 +17,8 @@ #define ATADDR_BCAST (__u8)255 #define DDP_MAXSZ 587 +#define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0) + struct at_addr { __u16 s_net; diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index a96e034ce..eb91dd0fa 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h @@ -54,6 +54,7 @@ extern int init_aout_binfmt(void); extern int init_script_binfmt(void); extern int init_java_binfmt(void); extern int init_em86_binfmt(void); +extern int init_misc_binfmt(void); extern int prepare_binprm(struct linux_binprm *); extern void remove_arg_zero(struct linux_binprm *); diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h new file mode 100644 index 000000000..e9ef418f7 --- /dev/null +++ b/include/linux/console_struct.h @@ -0,0 +1,142 @@ +/* + * console_struct.h + * + * Data structure and defines shared between console.c, vga.c and tga.c + */ + +#define NPAR 16 + +struct vc_data { + unsigned long vc_screenbuf_size; + unsigned short vc_video_erase_char; /* Background erase character */ + unsigned char vc_attr; /* Current attributes */ + unsigned char vc_def_color; /* Default colors */ + unsigned char vc_color; /* Foreground & background */ + unsigned char vc_s_color; /* Saved foreground & background */ + unsigned char vc_ulcolor; /* Colour for underline mode */ + unsigned char vc_halfcolor; /* Colour for half intensity mode */ + unsigned long vc_origin; /* Used for EGA/VGA fast scroll */ + unsigned long vc_scr_end; /* Used for EGA/VGA fast scroll */ + unsigned long vc_pos; + unsigned long vc_x,vc_y; + unsigned long vc_top,vc_bottom; + unsigned long vc_state; + unsigned long vc_npar,vc_par[NPAR]; + unsigned long vc_video_mem_start; /* Start of video RAM */ + unsigned long vc_video_mem_end; /* End of video RAM (sort of) */ + unsigned long vc_saved_x; + unsigned long vc_saved_y; + /* mode flags */ + unsigned long vc_charset : 1; /* Character set G0 / G1 */ + unsigned long vc_s_charset : 1; /* Saved character set */ + unsigned long vc_disp_ctrl : 1; /* Display chars < 32? */ + unsigned long vc_toggle_meta : 1; /* Toggle high bit? */ + unsigned long vc_decscnm : 1; /* Screen Mode */ + unsigned long vc_decom : 1; /* Origin Mode */ + unsigned long vc_decawm : 1; /* Autowrap Mode */ + unsigned long vc_deccm : 1; /* Cursor Visible */ + unsigned long vc_decim : 1; /* Insert Mode */ + unsigned long vc_deccolm : 1; /* 80/132 Column Mode */ + /* attribute flags */ + unsigned long vc_intensity : 2; /* 0=half-bright, 1=normal, 2=bold */ + unsigned long vc_underline : 1; + unsigned long vc_blink : 1; + unsigned long vc_reverse : 1; + unsigned long vc_s_intensity : 2; /* saved rendition */ + unsigned long vc_s_underline : 1; + unsigned long vc_s_blink : 1; + unsigned long vc_s_reverse : 1; + /* misc */ + unsigned long vc_ques : 1; + unsigned long vc_need_wrap : 1; + unsigned long vc_can_do_color : 1; + unsigned long vc_has_scrolled : 1; /* Info for unblank_screen */ + unsigned long vc_kmalloced : 1; /* kfree_s() needed */ + unsigned long vc_report_mouse : 2; + unsigned char vc_utf : 1; /* Unicode UTF-8 encoding */ + unsigned char vc_utf_count; + long vc_utf_char; + unsigned long vc_tab_stop[5]; /* Tab stops. 160 columns. */ + unsigned char vc_palette[16*3]; /* Colour palette for VGA+ */ + unsigned short * vc_translate; + unsigned char vc_G0_charset; + unsigned char vc_G1_charset; + unsigned char vc_saved_G0; + unsigned char vc_saved_G1; + unsigned int vc_bell_pitch; /* Console bell pitch */ + unsigned int vc_bell_duration; /* Console bell duration */ + /* additional information is in vt_kern.h */ +}; + +struct vc { + struct vc_data *d; + + /* might add scrmem, vt_struct, kbd at some time, + to have everything in one place - the disadvantage + would be that vc_cons etc can no longer be static */ +}; + +extern struct vc vc_cons [MAX_NR_CONSOLES]; + +#define screenbuf_size (vc_cons[currcons].d->vc_screenbuf_size) +#define origin (vc_cons[currcons].d->vc_origin) +#define scr_end (vc_cons[currcons].d->vc_scr_end) +#define pos (vc_cons[currcons].d->vc_pos) +#define top (vc_cons[currcons].d->vc_top) +#define bottom (vc_cons[currcons].d->vc_bottom) +#define x (vc_cons[currcons].d->vc_x) +#define y (vc_cons[currcons].d->vc_y) +#define vc_state (vc_cons[currcons].d->vc_state) +#define npar (vc_cons[currcons].d->vc_npar) +#define par (vc_cons[currcons].d->vc_par) +#define ques (vc_cons[currcons].d->vc_ques) +#define attr (vc_cons[currcons].d->vc_attr) +#define saved_x (vc_cons[currcons].d->vc_saved_x) +#define saved_y (vc_cons[currcons].d->vc_saved_y) +#define translate (vc_cons[currcons].d->vc_translate) +#define G0_charset (vc_cons[currcons].d->vc_G0_charset) +#define G1_charset (vc_cons[currcons].d->vc_G1_charset) +#define saved_G0 (vc_cons[currcons].d->vc_saved_G0) +#define saved_G1 (vc_cons[currcons].d->vc_saved_G1) +#define utf (vc_cons[currcons].d->vc_utf) +#define utf_count (vc_cons[currcons].d->vc_utf_count) +#define utf_char (vc_cons[currcons].d->vc_utf_char) +#define video_mem_start (vc_cons[currcons].d->vc_video_mem_start) +#define video_mem_end (vc_cons[currcons].d->vc_video_mem_end) +#define video_erase_char (vc_cons[currcons].d->vc_video_erase_char) +#define disp_ctrl (vc_cons[currcons].d->vc_disp_ctrl) +#define toggle_meta (vc_cons[currcons].d->vc_toggle_meta) +#define decscnm (vc_cons[currcons].d->vc_decscnm) +#define decom (vc_cons[currcons].d->vc_decom) +#define decawm (vc_cons[currcons].d->vc_decawm) +#define deccm (vc_cons[currcons].d->vc_deccm) +#define decim (vc_cons[currcons].d->vc_decim) +#define deccolm (vc_cons[currcons].d->vc_deccolm) +#define need_wrap (vc_cons[currcons].d->vc_need_wrap) +#define has_scrolled (vc_cons[currcons].d->vc_has_scrolled) +#define kmalloced (vc_cons[currcons].d->vc_kmalloced) +#define report_mouse (vc_cons[currcons].d->vc_report_mouse) +#define color (vc_cons[currcons].d->vc_color) +#define s_color (vc_cons[currcons].d->vc_s_color) +#define def_color (vc_cons[currcons].d->vc_def_color) +#define foreground (color & 0x0f) +#define background (color & 0xf0) +#define charset (vc_cons[currcons].d->vc_charset) +#define s_charset (vc_cons[currcons].d->vc_s_charset) +#define intensity (vc_cons[currcons].d->vc_intensity) +#define underline (vc_cons[currcons].d->vc_underline) +#define blink (vc_cons[currcons].d->vc_blink) +#define reverse (vc_cons[currcons].d->vc_reverse) +#define s_intensity (vc_cons[currcons].d->vc_s_intensity) +#define s_underline (vc_cons[currcons].d->vc_s_underline) +#define s_blink (vc_cons[currcons].d->vc_s_blink) +#define s_reverse (vc_cons[currcons].d->vc_s_reverse) +#define ulcolor (vc_cons[currcons].d->vc_ulcolor) +#define halfcolor (vc_cons[currcons].d->vc_halfcolor) +#define tab_stop (vc_cons[currcons].d->vc_tab_stop) +#define palette (vc_cons[currcons].d->vc_palette) +#define bell_pitch (vc_cons[currcons].d->vc_bell_pitch) +#define bell_duration (vc_cons[currcons].d->vc_bell_duration) + +#define vcmode (vt_cons[currcons]->vc_mode) +#define structsize (sizeof(struct vc_data) + sizeof(struct vt_struct)) diff --git a/include/linux/consolemap.h b/include/linux/consolemap.h new file mode 100644 index 000000000..9aba19db3 --- /dev/null +++ b/include/linux/consolemap.h @@ -0,0 +1,14 @@ +/* + * consolemap.h + * + * Interface between console.c, selection.c and consolemap.c + */ +#define LAT1_MAP 0 +#define GRAF_MAP 1 +#define IBMPC_MAP 2 +#define USER_MAP 3 + +extern int hashtable_contents_valid; +extern unsigned char inverse_translate(int glyph); +extern unsigned short *set_translate(int m); +extern int conv_uni_to_pc(long ucs); diff --git a/include/linux/dalloc.h b/include/linux/dalloc.h new file mode 100644 index 000000000..659eef522 --- /dev/null +++ b/include/linux/dalloc.h @@ -0,0 +1,102 @@ +#ifndef DALLOC_H +#define DALLOC_H +/* + * $Id: dalloc.h,v 1.3 1997/06/13 04:39:34 davem Exp $ + * + * include/linux/dalloc.h - alloc routines for dcache + * alloc / free space for pathname strings + * Copyright (C) 1997, Thomas Schoebel-Theuer, + * <schoebel@informatik.uni-stuttgart.de>. + */ + +#define D_MAXLEN 1024 + +/* public flags for d_add() */ +#define D_NORMAL 0 +#define D_BASKET 1 /* put into basket (deleted/unref'd files) */ +#define D_DUPLICATE 2 /* allow duplicate entries */ +#define D_NOCHECKDUP 4 /* no not check for duplicates */ + +/* public flags for d_flag */ +#define D_PRELOADED 8 + +/* public flags for d_del() */ +#define D_REMOVE 0 +#define D_NO_CLEAR_INODE 1 + +#define IS_ROOT(x) ((x) == (x)->d_parent) + +struct dentry { + union { + struct inode * d_inode; /* Where the name belongs to */ + unsigned long d_ino; /* for preliminary entries */ + } u; + struct dentry * d_parent; /* parent directory */ + struct dentry * d_next; /* hardlink aliasname / empty list */ + struct dentry * d_prev; /* hardlink aliasname */ + struct dentry * d_hash_next; + struct dentry * d_hash_prev; + struct dentry * d_basket_next; + struct dentry * d_basket_prev; + short d_len; /* set by dalloc() */ + short d_flag; + char d_name[D_MAXLEN]; +}; + +/* "quick string" -- I introduced this to shorten the parameter list + * of many routines. Think of it as a (str,stlen) pair. + * Storing the len instead of doing strlen() very often is performance + * critical. + */ +struct qstr { + const char * name; + int len; +}; + +extern struct dentry * the_root; + +/* Note that all these routines must be called with vfs_lock() held */ + +/* get inode, if necessary retrieve it with iget() */ +extern blocking struct inode * d_inode(struct dentry ** changing_entry); + +/* allocate proper space for the len */ +extern struct dentry * d_alloc(struct dentry * parent, int len, int isdir); + +/* only used once at mount_root() */ +extern blocking +struct dentry * d_alloc_root(struct inode * root_inode); + +/* d_inode is connected with inode, and d_name is copied from ininame. + * either of them may be NULL, but when ininame is NULL, dname must be + * set by the caller prior to calling this. */ +extern blocking +void d_add(struct dentry * entry, struct inode * inode, + struct qstr * ininame, int flags); + +/* combination of d_alloc() and d_add(), less lookup overhead */ +extern blocking +struct dentry * d_entry(struct dentry * parent, struct qstr * name, struct inode * inode); +extern blocking +void d_entry_preliminary(struct dentry * parent, struct qstr * name, unsigned long ino); + +/* recursive d_del() all successors */ +extern blocking +void d_del(struct dentry * entry, int flags); + +/* used for rename() and baskets */ +extern blocking +void d_move(struct dentry * entry, struct inode * newdir, + struct qstr * newname, struct qstr * newapp); + +/* appendix may either be NULL or be used for transname suffixes */ +extern struct dentry * d_lookup(struct inode * dir, struct qstr * name, + struct qstr * appendix); + +/* write full pathname into buffer and return length */ +extern int d_path(struct dentry * entry, struct inode * chroot, char * buf); + +extern struct dentry * d_basket(struct dentry * dir_entry); + +extern int d_isbasket(struct dentry * entry); +#endif diff --git a/include/linux/dlists.h b/include/linux/dlists.h new file mode 100644 index 000000000..f92485e40 --- /dev/null +++ b/include/linux/dlists.h @@ -0,0 +1,108 @@ +#ifndef DLISTS_H +#define DLISTS_H +/* + * include/linux/dlists.h - macros for double linked lists + * + * Copyright (C) 1997, Thomas Schoebel-Theuer, + * <schoebel@informatik.uni-stuttgart.de>. + */ + +/* dlists are cyclic ringlists, so the last element cannot be tested + * for NULL. Use the following construct for traversing cyclic lists: + * ptr = anchor; + * if(ptr) do { + * ... + * ptr = ptr->{something}_{next,prev}; + * } while(ptr != anchor); + * The effort here is paid off with much simpler inserts/removes. + * Examples for usage of these macros can be found in fs/ninode.c. + * To access the last element in constant time, simply use + * anchor->{something}_prev. + */ + +#define DEF_GENERIC_INSERT(CHANGE,PREFIX,NAME,TYPE,NEXT,PREV) \ +static inline void PREFIX##NAME(TYPE ** anchor, TYPE * elem)\ +{\ + TYPE * oldfirst = *anchor;\ + if(!oldfirst) {\ + elem->NEXT = elem->PREV = *anchor = elem;\ + } else {\ + elem->PREV = oldfirst->PREV;\ + elem->NEXT = oldfirst;\ + oldfirst->PREV->NEXT = elem;\ + oldfirst->PREV = elem;\ + if(CHANGE)\ + *anchor = elem;\ + }\ +} + +/* insert_* is always at the first position */ +#define DEF_INSERT(NAME,TYPE,NEXT,PREV) \ + DEF_GENERIC_INSERT(1,insert_,NAME,TYPE,NEXT,PREV) + +/* append_* is always at the tail */ +#define DEF_APPEND(NAME,TYPE,NEXT,PREV) \ + DEF_GENERIC_INSERT(0,append_,NAME,TYPE,NEXT,PREV) + +/* use this to insert _before_ oldelem somewhere in the middle of the list. + * the list must not be empty, and oldelem must be already a member.*/ +#define DEF_INSERT_MIDDLE(NAME,TYPE) \ +static inline void insert_middle_##NAME(TYPE ** anchor, TYPE * oldelem, TYPE * elem)\ +{\ + int status = (oldelem == *anchor);\ + insert_##NAME(&oldelem, elem);\ + if(status)\ + *anchor = oldelem;\ +} + +/* remove can be done with any element in the list */ +#define DEF_REMOVE(NAME,TYPE,NEXT,PREV) \ +static inline void remove_##NAME(TYPE ** anchor, TYPE * elem)\ +{\ + TYPE * next = elem->NEXT;\ + if(next == elem) {\ + *anchor = NULL;\ + } else {\ + TYPE * prev = elem->PREV;\ + prev->NEXT = next;\ + next->PREV = prev;\ + elem->NEXT = elem->PREV = NULL;/*leave this during debugging*/\ + if(*anchor == elem)\ + *anchor = next;\ + }\ +} + + +/* According to ideas from David S. Miller, here is a slightly + * more efficient plug-in compatible version using non-cyclic lists, + * but allowing neither backward traversals nor constant time access + * to the last element. + * Note that although the interface is the same, the PPREV pointer must be + * declared doubly indirect and the test for end-of-list is different. */ + +/* as above, this inserts always at the head */ +#define DEF_LIN_INSERT(NAME,TYPE,NEXT,PPREV) \ +static inline void insert_##NAME(TYPE ** anchor, TYPE * elem)\ +{\ + TYPE * first;\ + if((elem->NEXT = first = *anchor))\ + first->PPREV = &elem->NEXT;\ + *anchor = elem;\ + elem->PPREV = anchor;\ +} + +/* as above, this works with any list element */ +#define DEF_LIN_REMOVE(NAME,TYPE,NEXT,PPREV) \ +static inline void remove_##NAME(TYPE ** anchor, TYPE * elem)\ +{\ + TYPE * pprev;\ + if((pprev = elem->PPREV)) {\ + TYPE * next;\ + if((next = elem->NEXT))\ + next->PPREV = pprev;\ + *pprev = next;\ + elem->PPREV = elem->NEXT = NULL; /*leave this for debugging*/\ + }\ +} + +#endif diff --git a/include/linux/ext2_fs.h b/include/linux/ext2_fs.h index b5f2b5f15..9c66cfc29 100644 --- a/include/linux/ext2_fs.h +++ b/include/linux/ext2_fs.h @@ -502,7 +502,7 @@ extern int ext2_symlink (struct inode *, const char *, int, const char *); extern int ext2_link (struct inode *, struct inode *, const char *, int); extern int ext2_mknod (struct inode *, const char *, int, int, int); extern int ext2_rename (struct inode *, const char *, int, - struct inode *, const char *, int, int); + struct inode *, const char *, int); /* super.c */ extern void ext2_error (struct super_block *, const char *, const char *, ...) diff --git a/include/linux/fs.h b/include/linux/fs.h index 1918471ab..76fa53a7e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -15,6 +15,12 @@ #include <linux/net.h> #include <linux/kdev_t.h> #include <linux/ioctl.h> +#include <asm/atomic.h> + +/* Prefixes for routines (having no effect), but indicate what + * the routine may do. This can greatly ease reasoning about routines... + */ +#define blocking /*routine may schedule()*/ /* * It's silly to have NR_OPEN bigger than NR_FILE, but I'll fix @@ -34,7 +40,7 @@ #define BLOCK_SIZE_BITS 10 /* And dynamically-tunable limits and defaults: */ -extern int max_inodes, nr_inodes; +extern int max_inodes; extern int max_files, nr_files; #define NR_INODE 4096 /* this should be bigger than NR_FILE */ #define NR_FILE 1024 /* this can well be larger on a larger system */ @@ -60,6 +66,17 @@ extern int max_files, nr_files; #define SEL_OUT 2 #define SEL_EX 4 +/* public flags for file_system_type */ +#define FS_REQUIRES_DEV 1 +#define FS_NO_DCACHE 2 /* Only dcache the necessary things. */ +#define FS_NO_PRELIM 4 /* prevent preloading of dentries, even if + * FS_NO_DCACHE is not set. + */ +#define FS_IBASKET 8 /* FS does callback to free_ibasket() if space gets low. */ + +/* public flags for i_status */ +#define ST_MODIFIED 1024 + /* * These are the fs-independent mount-flags: up to 16 flags are supported */ @@ -87,6 +104,13 @@ extern int max_files, nr_files; #define MS_MGC_MSK 0xffff0000 /* magic flag number mask */ /* + * Public flags for namei() + */ +#define NAM_PLAIN 0 /* Retrieve last component of pathname as is. */ +#define NAM_FOLLOW_LINK 2 /* If last component of path is a symlink, follow it */ +#define NAM_FOLLOW_TRAILSLASH 4 /* Follow last symlink only if trailed by slash. */ + +/* * Note that read-only etc flags are inode-specific: setting some file-system * flags just means all the inodes inherit those flags by default. It might be * possible to override it selectively if you really wanted to with some @@ -281,58 +305,75 @@ struct iattr { #include <linux/quota.h> struct inode { - struct inode *i_hash_next; - struct inode **i_hash_pprev; - struct inode *i_next; - struct inode **i_pprev; - unsigned long i_ino; - kdev_t i_dev; - unsigned short i_count; - umode_t i_mode; - nlink_t i_nlink; - uid_t i_uid; - gid_t i_gid; - kdev_t i_rdev; - off_t i_size; - time_t i_atime; - time_t i_mtime; - time_t i_ctime; - unsigned long i_blksize; - unsigned long i_blocks; - unsigned long i_version; - unsigned long i_nrpages; - struct semaphore i_sem; - struct inode_operations *i_op; - struct super_block *i_sb; - struct wait_queue *i_wait; - struct file_lock *i_flock; - struct vm_area_struct *i_mmap; - struct page *i_pages; - struct dquot *i_dquot[MAXQUOTAS]; - struct inode *i_bound_to, *i_bound_by; - struct inode *i_mount; - unsigned short i_flags; - unsigned char i_lock; - unsigned char i_dirt; - unsigned char i_pipe; - unsigned char i_sock; - int i_writecount; - unsigned int i_attr_flags; + struct inode *i_hash_next; + struct inode *i_hash_prev; + struct inode *i_next; + struct inode *i_prev; + + unsigned long i_ino; + kdev_t i_dev; + atomic_t i_count; + umode_t i_mode; + nlink_t i_nlink; + uid_t i_uid; + gid_t i_gid; + kdev_t i_rdev; + off_t i_size; + time_t i_atime; + time_t i_mtime; + time_t i_ctime; + unsigned long i_blksize; + unsigned long i_blocks; + unsigned long i_version; + unsigned long i_nrpages; + struct semaphore i_sem; + struct inode_operations *i_op; + struct super_block *i_sb; + struct wait_queue *i_wait; + struct file_lock *i_flock; + struct vm_area_struct *i_mmap; + struct page *i_pages; + struct dquot *i_dquot[MAXQUOTAS]; + + struct inode *i_lru_next; + struct inode *i_lru_prev; + + struct inode *i_basket_next; + struct inode *i_basket_prev; + struct dentry *i_dentry; + + short i_ddir_count; + short i_dent_count; + unsigned short i_status; + unsigned short i_reuse_count; + + struct inode *i_mount; + unsigned int i_flags; + unsigned char i_lock; + unsigned char i_dirt; + unsigned char i_pipe; + unsigned char i_sock; + + unsigned char i_level; + unsigned short i_fill; + + int i_writecount; + unsigned int i_attr_flags; union { - struct pipe_inode_info pipe_i; - struct minix_inode_info minix_i; - struct ext2_inode_info ext2_i; - struct hpfs_inode_info hpfs_i; - struct msdos_inode_info msdos_i; - struct umsdos_inode_info umsdos_i; - struct iso_inode_info isofs_i; - struct nfs_inode_info nfs_i; - struct sysv_inode_info sysv_i; - struct affs_inode_info affs_i; - struct ufs_inode_info ufs_i; - struct romfs_inode_info romfs_i; - struct socket socket_i; - void * generic_ip; + struct pipe_inode_info pipe_i; + struct minix_inode_info minix_i; + struct ext2_inode_info ext2_i; + struct hpfs_inode_info hpfs_i; + struct msdos_inode_info msdos_i; + struct umsdos_inode_info umsdos_i; + struct iso_inode_info isofs_i; + struct nfs_inode_info nfs_i; + struct sysv_inode_info sysv_i; + struct affs_inode_info affs_i; + struct ufs_inode_info ufs_i; + struct romfs_inode_info romfs_i; + struct socket socket_i; + void *generic_ip; } u; }; @@ -450,33 +491,38 @@ extern int fasync_helper(struct inode *, struct file *, int, struct fasync_struc #include <linux/romfs_fs_sb.h> struct super_block { - kdev_t s_dev; - unsigned long s_blocksize; - unsigned char s_blocksize_bits; - unsigned char s_lock; - unsigned char s_rd_only; - unsigned char s_dirt; - struct file_system_type *s_type; - struct super_operations *s_op; - struct dquot_operations *dq_op; - unsigned long s_flags; - unsigned long s_magic; - unsigned long s_time; - struct inode * s_covered; - struct inode * s_mounted; - struct wait_queue * s_wait; + kdev_t s_dev; + unsigned long s_blocksize; + unsigned char s_blocksize_bits; + unsigned char s_lock; + unsigned char s_rd_only; + unsigned char s_dirt; + struct file_system_type *s_type; + struct super_operations *s_op; + struct dquot_operations *dq_op; + unsigned long s_flags; + unsigned long s_magic; + unsigned long s_time; + struct inode *s_covered; + struct inode *s_mounted; + struct wait_queue *s_wait; + + struct inode *s_ibasket; + short int s_ibasket_count; + short int s_ibasket_max; + union { - struct minix_sb_info minix_sb; - struct ext2_sb_info ext2_sb; - struct hpfs_sb_info hpfs_sb; - struct msdos_sb_info msdos_sb; - struct isofs_sb_info isofs_sb; - struct nfs_sb_info nfs_sb; - struct sysv_sb_info sysv_sb; - struct affs_sb_info affs_sb; - struct ufs_sb_info ufs_sb; - struct romfs_sb_info romfs_sb; - void *generic_sbp; + struct minix_sb_info minix_sb; + struct ext2_sb_info ext2_sb; + struct hpfs_sb_info hpfs_sb; + struct msdos_sb_info msdos_sb; + struct isofs_sb_info isofs_sb; + struct nfs_sb_info nfs_sb; + struct sysv_sb_info sysv_sb; + struct affs_sb_info affs_sb; + struct ufs_sb_info ufs_sb; + struct romfs_sb_info romfs_sb; + void *generic_sbp; } u; }; @@ -515,9 +561,8 @@ struct inode_operations { int (*mkdir) (struct inode *,const char *,int,int); int (*rmdir) (struct inode *,const char *,int); int (*mknod) (struct inode *,const char *,int,int,int); - int (*rename) (struct inode *,const char *,int,struct inode *,const char *,int, int); + int (*rename) (struct inode *,const char *,int,struct inode *,const char *,int); int (*readlink) (struct inode *,char *,int); - int (*follow_link) (struct inode *,struct inode *,int,int,struct inode **); int (*readpage) (struct inode *, struct page *); int (*writepage) (struct inode *, struct page *); int (*bmap) (struct inode *,int); @@ -551,9 +596,9 @@ struct dquot_operations { }; struct file_system_type { - struct super_block *(*read_super) (struct super_block *, void *, int); const char *name; - int requires_dev; + int fs_flags; + struct super_block *(*read_super) (struct super_block *, void *, int); struct file_system_type * next; }; @@ -644,8 +689,7 @@ extern int fsync_dev(kdev_t dev); extern void sync_supers(kdev_t dev); extern int bmap(struct inode * inode,int block); extern int notify_change(struct inode *, struct iattr *); -extern int namei(const char * pathname, struct inode ** res_inode); -extern int lnamei(const char * pathname, struct inode ** res_inode); +extern int namei(int retr_mode, const char *pathname, struct inode **res_inode); extern int permission(struct inode * inode,int mask); extern int get_write_access(struct inode *inode); extern void put_write_access(struct inode *inode); @@ -653,12 +697,116 @@ extern int open_namei(const char * pathname, int flag, int mode, struct inode ** res_inode, struct inode * base); extern int do_mknod(const char * filename, int mode, dev_t dev); extern int do_pipe(int *); -extern void iput(struct inode * inode); -extern struct inode * __iget(struct super_block * sb,int nr,int crsmnt); -extern struct inode * get_empty_inode(void); + +#include <asm/semaphore.h> + +/* Intended for short locks of the global data structures in inode.c. + * Could be replaced with spinlocks completely, since there is + * no blocking during manipulation of the static data; however the + * lock in invalidate_inodes() may last relatively long. + */ +extern struct semaphore vfs_sem; +extern inline void vfs_lock(void) +{ +#if 0 +#ifdef __SMP__ + down(&vfs_sem); +#endif +#endif +} + +extern inline void vfs_unlock(void) +{ +#if 0 +#ifdef __SMP__ + up(&vfs_sem); +#endif +#endif +} + +/* Not to be used by ordinary vfs users */ +extern void _get_inode(struct inode * inode); +extern blocking void __iput(struct inode * inode); + +/* This must not be called if the inode is not in use (i.e. given + * back with iput(). The atomic inc assumes that the inode is + * already in use, and just has to be incremented higher. + * Please do not directly manipulate i_count any more. + * Use iget, iinc and iput. + * You may test i_count for zero if you are aware that it + * might change under you. + */ +extern inline void iinc(struct inode * inode) +{ + atomic_inc(&inode->i_count); +} + +/* The same, but the inode may not be in use. This must be called + * with vfslock() held, and be asure that the inode argument is + * valid (i.e. not out of cache). So the vfs_lock() must span the + * retrieval method of the inode. + */ +extern inline void iinc_zero(struct inode * inode) +{ + if(!atomic_read(&inode->i_count)) { + atomic_inc(&inode->i_count); + _get_inode(inode); + } else + atomic_inc(&inode->i_count); +} + +extern blocking void _iput(struct inode * inode); +extern inline blocking void iput(struct inode * inode) +{ + if(inode) { + extern void wake_up_interruptible(struct wait_queue **q); + + if(inode->i_pipe) + wake_up_interruptible(&inode->u.pipe_i.wait); + + /* It does not matter if somebody re-increments it in between, + * only the _last_ user needs to call _iput(). + */ + if(atomic_dec_and_test(&inode->i_count) && inode->i_ddir_count <= 0) + _iput(inode); + } +} + +extern blocking struct inode * __iget(struct super_block * sb, unsigned long nr, int crsmnt); +extern blocking void _clear_inode(struct inode * inode, int external, int verbose); +extern blocking inline void clear_inode(struct inode * inode) +{ + vfs_lock(); + _clear_inode(inode, 1, 1); + vfs_unlock(); +} +extern blocking struct inode * _get_empty_inode(void); +extern inline blocking struct inode * get_empty_inode(void) +{ + struct inode * inode; + vfs_lock(); + inode = _get_empty_inode(); + vfs_unlock(); + return inode; +} +/* Please prefer to use this function in future, instead of using + * a get_empty_inode()/insert_inode_hash() combination. + * It allows for better checking and less race conditions. + */ +blocking struct inode * get_empty_inode_hashed(dev_t i_dev, unsigned long i_ino); + +extern inline blocking int free_ibasket(struct super_block * sb) +{ + extern blocking int _free_ibasket(struct super_block * sb); + int res; + vfs_lock(); + res = _free_ibasket(sb); + vfs_unlock(); + return res; +} + extern void insert_inode_hash(struct inode *); -extern void clear_inode(struct inode *); -extern struct inode * get_pipe_inode(void); +extern blocking struct inode * get_pipe_inode(void); extern int get_unused_fd(void); extern void put_unused_fd(int); extern struct file * get_empty_filp(void); @@ -694,6 +842,7 @@ extern int generic_file_mmap(struct inode *, struct file *, struct vm_area_struc extern long generic_file_read(struct inode *, struct file *, char *, unsigned long); extern long generic_file_write(struct inode *, struct file *, const char *, unsigned long); +extern struct super_block *get_super(kdev_t dev); extern void put_super(kdev_t dev); unsigned long generate_cluster(kdev_t dev, int b[], int size); unsigned long generate_cluster_swab32(kdev_t dev, int b[], int size); @@ -723,7 +872,8 @@ extern int dcache_lookup(struct inode *, const char *, int, unsigned long *); extern int inode_change_ok(struct inode *, struct iattr *); extern void inode_setattr(struct inode *, struct iattr *); -extern inline struct inode * iget(struct super_block * sb,int nr) +extern inline blocking +struct inode * iget(struct super_block * sb, unsigned long nr) { return __iget(sb, nr, 1); } diff --git a/include/linux/kbd_diacr.h b/include/linux/kbd_diacr.h new file mode 100644 index 000000000..1c1a3ff05 --- /dev/null +++ b/include/linux/kbd_diacr.h @@ -0,0 +1,8 @@ +#ifndef _DIACR_H +#define _DIACR_H +#include <linux/kd.h> + +extern struct kbdiacr accent_table[]; +extern unsigned int accent_table_size; + +#endif /* _DIACR_H */ diff --git a/include/linux/kbd_kern.h b/include/linux/kbd_kern.h new file mode 100644 index 000000000..2d7dc1b7e --- /dev/null +++ b/include/linux/kbd_kern.h @@ -0,0 +1,141 @@ +#ifndef _KBD_KERN_H +#define _KBD_KERN_H + +#include <linux/interrupt.h> +#include <linux/keyboard.h> + +extern int shift_state; + +extern char *func_table[MAX_NR_FUNC]; +extern char func_buf[]; +extern char *funcbufptr; +extern int funcbufsize, funcbufleft; + +/* + * kbd->xxx contains the VC-local things (flag settings etc..) + * + * Note: externally visible are LED_SCR, LED_NUM, LED_CAP defined in kd.h + * The code in KDGETLED / KDSETLED depends on the internal and + * external order being the same. + * + * Note: lockstate is used as index in the array key_map. + */ +struct kbd_struct { + + unsigned char lockstate; +/* 8 modifiers - the names do not have any meaning at all; + they can be associated to arbitrarily chosen keys */ +#define VC_SHIFTLOCK KG_SHIFT /* shift lock mode */ +#define VC_ALTGRLOCK KG_ALTGR /* altgr lock mode */ +#define VC_CTRLLOCK KG_CTRL /* control lock mode */ +#define VC_ALTLOCK KG_ALT /* alt lock mode */ +#define VC_SHIFTLLOCK KG_SHIFTL /* shiftl lock mode */ +#define VC_SHIFTRLOCK KG_SHIFTR /* shiftr lock mode */ +#define VC_CTRLLLOCK KG_CTRLL /* ctrll lock mode */ +#define VC_CTRLRLOCK KG_CTRLR /* ctrlr lock mode */ + unsigned char slockstate; /* for `sticky' Shift, Ctrl, etc. */ + + unsigned char ledmode:2; /* one 2-bit value */ +#define LED_SHOW_FLAGS 0 /* traditional state */ +#define LED_SHOW_IOCTL 1 /* only change leds upon ioctl */ +#define LED_SHOW_MEM 2 /* `heartbeat': peek into memory */ + + unsigned char ledflagstate:3; /* flags, not lights */ + unsigned char default_ledflagstate:3; +#define VC_SCROLLOCK 0 /* scroll-lock mode */ +#define VC_NUMLOCK 1 /* numeric lock mode */ +#define VC_CAPSLOCK 2 /* capslock mode */ + + unsigned char kbdmode:2; /* one 2-bit value */ +#define VC_XLATE 0 /* translate keycodes using keymap */ +#define VC_MEDIUMRAW 1 /* medium raw (keycode) mode */ +#define VC_RAW 2 /* raw (scancode) mode */ +#define VC_UNICODE 3 /* Unicode mode */ + + unsigned char modeflags:5; +#define VC_APPLIC 0 /* application key mode */ +#define VC_CKMODE 1 /* cursor key mode */ +#define VC_REPEAT 2 /* keyboard repeat */ +#define VC_CRLF 3 /* 0 - enter sends CR, 1 - enter sends CRLF */ +#define VC_META 4 /* 0 - meta, 1 - meta=prefix with ESC */ +}; + +extern struct kbd_struct kbd_table[]; + +extern int kbd_init(void); + +extern unsigned char getledstate(void); +extern void setledstate(struct kbd_struct *kbd, unsigned int led); + +extern int do_poke_blanked_console; + +extern inline void show_console(void) +{ + do_poke_blanked_console = 1; + mark_bh(CONSOLE_BH); +} + +extern inline void set_console(int nr) +{ + want_console = nr; + mark_bh(CONSOLE_BH); +} + +extern inline void set_leds(void) +{ + mark_bh(KEYBOARD_BH); +} + +extern inline int vc_kbd_mode(struct kbd_struct * kbd, int flag) +{ + return ((kbd->modeflags >> flag) & 1); +} + +extern inline int vc_kbd_led(struct kbd_struct * kbd, int flag) +{ + return ((kbd->ledflagstate >> flag) & 1); +} + +extern inline void set_vc_kbd_mode(struct kbd_struct * kbd, int flag) +{ + kbd->modeflags |= 1 << flag; +} + +extern inline void set_vc_kbd_led(struct kbd_struct * kbd, int flag) +{ + kbd->ledflagstate |= 1 << flag; +} + +extern inline void clr_vc_kbd_mode(struct kbd_struct * kbd, int flag) +{ + kbd->modeflags &= ~(1 << flag); +} + +extern inline void clr_vc_kbd_led(struct kbd_struct * kbd, int flag) +{ + kbd->ledflagstate &= ~(1 << flag); +} + +extern inline void chg_vc_kbd_lock(struct kbd_struct * kbd, int flag) +{ + kbd->lockstate ^= 1 << flag; +} + +extern inline void chg_vc_kbd_slock(struct kbd_struct * kbd, int flag) +{ + kbd->slockstate ^= 1 << flag; +} + +extern inline void chg_vc_kbd_mode(struct kbd_struct * kbd, int flag) +{ + kbd->modeflags ^= 1 << flag; +} + +extern inline void chg_vc_kbd_led(struct kbd_struct * kbd, int flag) +{ + kbd->ledflagstate ^= 1 << flag; +} + +#define U(x) ((x) ^ 0xf000) + +#endif diff --git a/include/linux/kbd_ll.h b/include/linux/kbd_ll.h new file mode 100644 index 000000000..d83f9ea8a --- /dev/null +++ b/include/linux/kbd_ll.h @@ -0,0 +1,12 @@ +/* + * Interface between the low-level keyboard driver and the keymapper + */ + +#ifndef _KBD_LL_H +#define _KBD_LL_H + +extern struct pt_regs *kbd_pt_regs; + +void handle_scancode(unsigned char scancode); + +#endif /* _KBD_LL_H */ diff --git a/include/linux/linkage.h b/include/linux/linkage.h index 462a90808..148eaad22 100644 --- a/include/linux/linkage.h +++ b/include/linux/linkage.h @@ -15,6 +15,10 @@ #define SYMBOL_NAME_LABEL(X) X/**/: #endif +#ifdef __mc68000__ +#define __ALIGN .align 4 +#define __ALIGN_STR ".align 4" +#else #if !defined(__i486__) && !defined(__i586__) #define __ALIGN .align 4,0x90 #define __ALIGN_STR ".align 4,0x90" @@ -22,6 +26,7 @@ #define __ALIGN .align 16,0x90 #define __ALIGN_STR ".align 16,0x90" #endif /* __i486__/__i586__ */ +#endif /* __mc68000__ */ #ifdef __ASSEMBLY__ diff --git a/include/linux/minix_fs.h b/include/linux/minix_fs.h index 3bc020fcd..069686fff 100644 --- a/include/linux/minix_fs.h +++ b/include/linux/minix_fs.h @@ -100,7 +100,7 @@ extern int minix_symlink(struct inode * inode, const char * name, int len, extern int minix_link(struct inode * oldinode, struct inode * dir, const char * name, int len); extern int minix_mknod(struct inode * dir, const char * name, int len, int mode, int rdev); extern int minix_rename(struct inode * old_dir, const char * old_name, int old_len, - struct inode * new_dir, const char * new_name, int new_len, int must_be_dir); + struct inode * new_dir, const char * new_name, int new_len); extern struct inode * minix_new_inode(const struct inode * dir); extern void minix_free_inode(struct inode * inode); extern unsigned long minix_count_free_inodes(struct super_block *sb); diff --git a/include/linux/mm.h b/include/linux/mm.h index 6ebf15a55..c8b9046a7 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -124,7 +124,7 @@ typedef struct page { struct wait_queue *wait; struct page **pprev_hash; struct buffer_head * buffers; - unsigned long swap_unlock_entry; + unsigned long pg_swap_entry; unsigned long map_nr; /* page->map_nr == page - mem_map */ } mem_map_t; @@ -138,6 +138,7 @@ typedef struct page { #define PG_swap_unlock_after 6 #define PG_DMA 7 #define PG_Slab 8 +#define PG_swap_cache 9 #define PG_reserved 31 /* Make it prettier to test the above... */ @@ -151,10 +152,19 @@ typedef struct page { #define PageSwapUnlockAfter(page) (test_bit(PG_swap_unlock_after, &(page)->flags)) #define PageDMA(page) (test_bit(PG_DMA, &(page)->flags)) #define PageSlab(page) (test_bit(PG_Slab, &(page)->flags)) +#define PageSwapCache(page) (test_bit(PG_swap_cache, &(page)->flags)) #define PageReserved(page) (test_bit(PG_reserved, &(page)->flags)) #define PageSetSlab(page) (set_bit(PG_Slab, &(page)->flags)) +#define PageSetSwapCache(page) (set_bit(PG_swap_cache, &(page)->flags)) +#define PageTestandSetSwapCache(page) \ + (test_and_set_bit(PG_swap_cache, &(page)->flags)) + #define PageClearSlab(page) (clear_bit(PG_Slab, &(page)->flags)) +#define PageClearSwapCache(page)(clear_bit(PG_swap_cache, &(page)->flags)) + +#define PageTestandClearSwapCache(page) \ + (test_and_clear_bit(PG_swap_cache, &(page)->flags)) /* * page->reserved denotes a page which must never be accessed (which diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h index d7f46b1d8..36ed2a890 100644 --- a/include/linux/msdos_fs.h +++ b/include/linux/msdos_fs.h @@ -261,8 +261,7 @@ extern int msdos_mkdir(struct inode *dir,const char *name,int len,int mode); extern int msdos_unlink(struct inode *dir,const char *name,int len); extern int msdos_unlink_umsdos(struct inode *dir,const char *name,int len); extern int msdos_rename(struct inode *old_dir,const char *old_name,int old_len, - struct inode *new_dir,const char *new_name,int new_len, - int must_be_dir); + struct inode *new_dir,const char *new_name,int new_len); /* fatfs_syms.c */ extern int init_fat_fs(void); @@ -274,8 +273,7 @@ extern int vfat_unlink(struct inode *dir,const char *name,int len); extern int vfat_mkdir(struct inode *dir,const char *name,int len,int mode); extern int vfat_rmdir(struct inode *dir,const char *name,int len); extern int vfat_rename(struct inode *old_dir,const char *old_name,int old_len, - struct inode *new_dir,const char *new_name,int new_len, - int must_be_dir); + struct inode *new_dir,const char *new_name,int new_len); extern void vfat_put_super(struct super_block *sb); extern struct super_block *vfat_read_super(struct super_block *sb,void *data, int silent); diff --git a/include/linux/nametrans.h b/include/linux/nametrans.h new file mode 100644 index 000000000..838e5a7f8 --- /dev/null +++ b/include/linux/nametrans.h @@ -0,0 +1,69 @@ +#ifndef NAMETRANS_H +#define NAMETRANS_H +/* + * $Id: nametrans.h,v 1.1 1997/06/04 08:26:57 davem Exp $ + * + * include/linux/nametrans.h - context-dependend filename suffixes. + * Copyright (C) 1997, Thomas Schoebel-Theuer, + * <schoebel@informatik.uni-stuttgart.de>. + */ + +#include <linux/dalloc.h> +#include <linux/sysctl.h> + +#define MAX_DEFAULT_TRANSLEN 128 + +/* only filenames matching the following length restrictions can be + * translated. I introduced these restrictions because they *greatly* + * simplify buffer management (no need to allocate kernel pages and free them). + * The maximal total length of a context-dependend filename is the + * sum of both constants. */ +#define MAX_TRANS_FILELEN 128 /* max len of a name that could be translated */ +#define MAX_TRANS_SUFFIX 64 /* max len of a #keyword=value# suffix */ + +/* max number of translations */ +#define MAX_TRANSLATIONS 16 + +struct translations { + int count; + struct qstr name[MAX_TRANSLATIONS]; + struct qstr c_name[MAX_TRANSLATIONS]; +}; + +/* global/default translations */ +extern char nametrans_txt[MAX_DEFAULT_TRANSLEN]; + +/* Any changer of a built-in translation must set this flag */ +extern int translations_dirty; + + +/* called once at boot time */ +extern void init_nametrans(void); + +/* set global translations */ +extern void nametrans_setup(char * line); + +/* return reusable global buffer. needed by VFS. */ +struct translations * get_translations(char * env); + +/* if the _first_ environment variable is "NAMETRANS", return + * a pointer to the list of appendices. + * You can set the first environment variable using + * 'env - NAMETRANS=... "`env`" command ...' + */ +extern char * env_transl(void); + +/* if name has the correct suffix "#keyword=correct_context#", + * return position of the suffix, else 0. + */ +extern char* testname(int restricted, char* name); + +/* for use in kernel/sysctrl.h */ +extern int nametrans_dostring(ctl_table * table, int write, struct file * filp, + void * buffer, size_t * lenp); +extern int nametrans_string(ctl_table * table, int * name, int nlen, + void * oldval, size_t * oldlenp, + void * newval, size_t newlen, void ** context); + + +#endif diff --git a/include/linux/nfsd/nfsfh.h b/include/linux/nfsd/nfsfh.h index 320a2816c..489762a36 100644 --- a/include/linux/nfsd/nfsfh.h +++ b/include/linux/nfsd/nfsfh.h @@ -151,7 +151,7 @@ __fh_put(struct svc_fh *fhp, char *file, int line) if (!(inode = fhp->fh_inode)) return; - if (!inode->i_count) { + if (!atomic_read(&inode->i_count)) { printk("nfsd: trying to free free inode in %s:%d\n" " dev %04x ino %ld, mode %07o\n", file, line, inode->i_dev, diff --git a/include/linux/omirr.h b/include/linux/omirr.h new file mode 100644 index 000000000..379867423 --- /dev/null +++ b/include/linux/omirr.h @@ -0,0 +1,17 @@ +/* + * fs/proc/omirr.c - online mirror support + * + * (C) 1997 Thomas Schoebel-Theuer + */ + +#ifndef OMIRR_H +#define OMIRR_H +#include <linux/fs.h> +#include <linux/dalloc.h> + +extern int omirr_print(struct dentry * ent1, struct dentry * ent2, + struct qstr * suffix, const char * fmt, ...); + +extern int omirr_printall(struct inode * inode, const char * fmt, ...); + +#endif diff --git a/include/linux/pci.h b/include/linux/pci.h index 10c0f76b7..b13929d6a 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -238,7 +238,9 @@ #define PCI_DEVICE_ID_ATI_68800 0x4158 #define PCI_DEVICE_ID_ATI_215CT222 0x4354 #define PCI_DEVICE_ID_ATI_210888CX 0x4358 +#define PCI_DEVICE_ID_ATI_215GT 0x4754 #define PCI_DEVICE_ID_ATI_210888GX 0x4758 +#define PCI_DEVICE_ID_ATI_264VT 0x5654 #define PCI_VENDOR_ID_VLSI 0x1004 #define PCI_DEVICE_ID_VLSI_82C592 0x0005 @@ -270,6 +272,7 @@ #define PCI_DEVICE_ID_DEC_TULIP_FAST 0x0009 #define PCI_DEVICE_ID_DEC_FDDI 0x000F #define PCI_DEVICE_ID_DEC_TULIP_PLUS 0x0014 +#define PCI_DEVICE_ID_DEC_21142 0x0019 #define PCI_DEVICE_ID_DEC_21052 0x0021 #define PCI_DEVICE_ID_DEC_21152 0x0024 @@ -279,12 +282,16 @@ #define PCI_DEVICE_ID_CIRRUS_5434_4 0x00a4 #define PCI_DEVICE_ID_CIRRUS_5434_8 0x00a8 #define PCI_DEVICE_ID_CIRRUS_5436 0x00ac +#define PCI_DEVICE_ID_CIRRUS_5446 0x00b8 +#define PCI_DEVICE_ID_CIRRUS_5464 0x00d4 #define PCI_DEVICE_ID_CIRRUS_6729 0x1100 #define PCI_DEVICE_ID_CIRRUS_7542 0x1200 #define PCI_DEVICE_ID_CIRRUS_7543 0x1202 +#define PCI_DEVICE_ID_CIRRUS_7541 0x1204 #define PCI_VENDOR_ID_IBM 0x1014 #define PCI_DEVICE_ID_IBM_82G2675 0x001d +#define PCI_DEVICE_ID_IBM_82351 0x0022 #define PCI_VENDOR_ID_WD 0x101c #define PCI_DEVICE_ID_WD_7197 0x3296 @@ -311,6 +318,7 @@ #define PCI_DEVICE_ID_CT_65545 0x00d8 #define PCI_DEVICE_ID_CT_65548 0x00dc #define PCI_DEVICE_ID_CT_65550 0x00e0 +#define PCI_DEVICE_ID_CT_65554 0x00e4 #define PCI_VENDOR_ID_MIRO 0x1031 #define PCI_DEVICE_ID_MIRO_36050 0x5601 @@ -328,6 +336,8 @@ #define PCI_DEVICE_ID_SI_601 0x0601 #define PCI_DEVICE_ID_SI_5511 0x5511 #define PCI_DEVICE_ID_SI_5513 0x5513 +#define PCI_DEVICE_ID_SI_5571 0x5571 +#define PCI_DEVICE_ID_SI_7001 0x7001 #define PCI_VENDOR_ID_HP 0x103c #define PCI_DEVICE_ID_HP_J2585A 0x1030 @@ -363,6 +373,11 @@ #define PCI_VENDOR_ID_WINBOND2 0x1050 #define PCI_DEVICE_ID_WINBOND2_89C940 0x0940 +#define PCI_VENDOR_ID_MOTOROLA 0x1057 +#define PCI_DEVICE_ID_MOTOROLA_MPC105 0x0001 +#define PCI_DEVICE_ID_MOTOROLA_MPC106 0x0002 +#define PCI_DEVICE_ID_MOTOROLA_RAVEN 0x4801 + #define PCI_VENDOR_ID_PROMISE 0x105a #define PCI_DEVICE_ID_PROMISE_5300 0x5300 @@ -421,6 +436,7 @@ #define PCI_VENDOR_ID_WINBOND 0x10ad #define PCI_DEVICE_ID_WINBOND_83769 0x0001 #define PCI_DEVICE_ID_WINBOND_82C105 0x0105 +#define PCI_DEVICE_ID_WINBOND_83C553 0x0565 #define PCI_VENDOR_ID_3COM 0x10b7 #define PCI_DEVICE_ID_3COM_3C590 0x5900 @@ -428,6 +444,7 @@ #define PCI_DEVICE_ID_3COM_3C595T4 0x5951 #define PCI_DEVICE_ID_3COM_3C595MII 0x5952 #define PCI_DEVICE_ID_3COM_3C900TPO 0x9000 +#define PCI_DEVICE_ID_3COM_3C900COMBO 0x9001 #define PCI_DEVICE_ID_3COM_3C905TX 0x9050 #define PCI_VENDOR_ID_AL 0x10b9 @@ -445,6 +462,7 @@ #define PCI_VENDOR_ID_ASP 0x10cd #define PCI_DEVICE_ID_ASP_ABP940 0x1200 +#define PCI_DEVICE_ID_ASP_ABP940U 0x1300 #define PCI_VENDOR_ID_CERN 0x10dc #define PCI_DEVICE_ID_CERN_SPSB_PMC 0x0001 @@ -456,8 +474,12 @@ #define PCI_VENDOR_ID_TEKRAM2 0x10e1 #define PCI_DEVICE_ID_TEKRAM2_690c 0x690c +#define PCI_VENDOR_ID_TUNDRA 0x10e3 +#define PCI_DEVICE_ID_TUNDRA_CA91C042 0x0000 + #define PCI_VENDOR_ID_AMCC 0x10e8 #define PCI_DEVICE_ID_AMCC_MYRINET 0x8043 +#define PCI_DEVICE_ID_AMCC_S5933 0x807d #define PCI_VENDOR_ID_INTERG 0x10ea #define PCI_DEVICE_ID_INTERG_1680 0x1680 @@ -472,7 +494,10 @@ #define PCI_VENDOR_ID_VIA 0x1106 #define PCI_DEVICE_ID_VIA_82C505 0x0505 #define PCI_DEVICE_ID_VIA_82C561 0x0561 +#define PCI_DEVICE_ID_VIA_82C586_1 0x0571 #define PCI_DEVICE_ID_VIA_82C576 0x0576 +#define PCI_DEVICE_ID_VIA_82C585 0x0585 +#define PCI_DEVICE_ID_VIA_82C586_0 0x0586 #define PCI_DEVICE_ID_VIA_82C416 0x1571 #define PCI_VENDOR_ID_VORTEX 0x1119 @@ -519,15 +544,22 @@ #define PCI_DEVICE_ID_MUTECH_MV1000 0x0001 #define PCI_VENDOR_ID_TOSHIBA 0x1179 +#define PCI_DEVICE_ID_TOSHIBA_601 0x0601 #define PCI_VENDOR_ID_ZEITNET 0x1193 #define PCI_DEVICE_ID_ZEITNET_1221 0x0001 #define PCI_DEVICE_ID_ZEITNET_1225 0x0002 +#define PCI_VENDOR_ID_OMEGA 0x119b +#define PCI_DEVICE_ID_OMEGA_PCMCIA 0x1221 + #define PCI_VENDOR_ID_SPECIALIX 0x11cb #define PCI_DEVICE_ID_SPECIALIX_XIO 0x4000 #define PCI_DEVICE_ID_SPECIALIX_RIO 0x8000 +#define PCI_VENDOR_ID_ZORAN 0x11de +#define PCI_DEVICE_ID_ZORAN_36120 0x6120 + #define PCI_VENDOR_ID_COMPEX 0x11f6 #define PCI_DEVICE_ID_COMPEX_RL2000 0x1401 @@ -543,6 +575,12 @@ #define PCI_DEVICE_ID_CYCLOM_Z_Lo 0x0200 #define PCI_DEVICE_ID_CYCLOM_Z_Hi 0x0201 +#define PCI_VENDOR_ID_3DFX 0x121a +#define PCI_DEVICE_ID_3DFX_VOODOO 0x0001 + +#define PCI_VENDOR_ID_SIGMADES 0x1236 +#define PCI_DEVICE_ID_SIGMADES_6425 0x6401 + #define PCI_VENDOR_ID_OPTIBASE 0x1255 #define PCI_DEVICE_ID_OPTIBASE_FORGE 0x1110 #define PCI_DEVICE_ID_OPTIBASE_FUSION 0x1210 @@ -556,10 +594,13 @@ #define PCI_VENDOR_ID_TEKRAM 0x1de1 #define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 -#define PCI_VENDOR_ID_3DLABS 0x3D3D +#define PCI_VENDOR_ID_3DLABS 0x3d3d #define PCI_DEVICE_ID_3DLABS_300SX 0x0001 +#define PCI_DEVICE_ID_3DLABS_DELTA 0x0003 +#define PCI_DEVICE_ID_3DLABS_PERMEDIA 0x0004 #define PCI_VENDOR_ID_AVANCE 0x4005 +#define PCI_DEVICE_ID_AVANCE_ALG2064 0x2064 #define PCI_DEVICE_ID_AVANCE_2302 0x2302 #define PCI_VENDOR_ID_S3 0x5333 @@ -582,6 +623,8 @@ #define PCI_DEVICE_ID_INTEL_82378 0x0484 #define PCI_DEVICE_ID_INTEL_82430 0x0486 #define PCI_DEVICE_ID_INTEL_82434 0x04a3 +#define PCI_DEVICE_ID_INTEL_82092AA_0 0x1221 +#define PCI_DEVICE_ID_INTEL_82092AA_1 0x1222 #define PCI_DEVICE_ID_INTEL_7116 0x1223 #define PCI_DEVICE_ID_INTEL_82596 0x1226 #define PCI_DEVICE_ID_INTEL_82865 0x1227 @@ -589,15 +632,19 @@ #define PCI_DEVICE_ID_INTEL_82437 0x122d #define PCI_DEVICE_ID_INTEL_82371_0 0x122e #define PCI_DEVICE_ID_INTEL_82371_1 0x1230 -#define PCI_DEVICE_ID_INTEL_430MX_0 0x1234 -#define PCI_DEVICE_ID_INTEL_430MX_1 0x1235 +#define PCI_DEVICE_ID_INTEL_82371MX 0x1234 +#define PCI_DEVICE_ID_INTEL_82437MX 0x1235 #define PCI_DEVICE_ID_INTEL_82441 0x1237 #define PCI_DEVICE_ID_INTEL_82439 0x1250 #define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000 #define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010 #define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020 #define PCI_DEVICE_ID_INTEL_82437VX 0x7030 +#define PCI_DEVICE_ID_INTEL_82439TX 0x7100 +#define PCI_DEVICE_ID_INTEL_82371AB_0 0x7110 #define PCI_DEVICE_ID_INTEL_82371AB 0x7111 +#define PCI_DEVICE_ID_INTEL_82371AB_2 0x7112 +#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113 #define PCI_DEVICE_ID_INTEL_P6 0x84c4 #define PCI_DEVICE_ID_INTEL_P6_2 0x84c5 diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index acc7c8f24..b0e33a0c6 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h @@ -48,8 +48,10 @@ enum root_directory_inos { PROC_RTC, PROC_LOCKS, PROC_ZORRO, + PROC_HARDWARE, PROC_SLABINFO, - PROC_PARPORT + PROC_PARPORT, + PROC_OMIRR /* whether enabled or not */ }; enum pid_directory_inos { @@ -133,6 +135,11 @@ enum net_directory_inos { PROC_NET_X25_ROUTES, PROC_NET_X25, PROC_NET_TR_RIF, + PROC_NET_DN_DEV, + PROC_NET_DN_ADJ, + PROC_NET_DN_L1, + PROC_NET_DN_L2, + PROC_NET_DN_SKT, PROC_NET_LAST }; @@ -354,6 +361,11 @@ extern struct inode_operations proc_fd_inode_operations; #if CONFIG_AP1000 extern struct inode_operations proc_ringbuf_inode_operations; #endif +extern struct inode_operations proc_omirr_inode_operations; + +/* Not sure whether this belongs here */ +int proc_arbitrary_lookup(struct inode * dir, const char * name, + int len, struct inode ** result); #endif /* diff --git a/include/linux/sched.h b/include/linux/sched.h index 215774036..189194a49 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -500,13 +500,8 @@ extern inline struct file *file_from_fd(const unsigned int fd) */ extern inline void __add_wait_queue(struct wait_queue ** p, struct wait_queue * wait) { - struct wait_queue *head = *p; - struct wait_queue *next = WAIT_QUEUE_HEAD(p); - - if (head) - next = head; + wait->next = *p ? : WAIT_QUEUE_HEAD(p); *p = wait; - wait->next = next; } extern rwlock_t waitqueue_lock; diff --git a/include/linux/selection.h b/include/linux/selection.h new file mode 100644 index 000000000..94d3d9a8e --- /dev/null +++ b/include/linux/selection.h @@ -0,0 +1,281 @@ +/* + * selection.h + * + * Interface between console.c, tty_io.c, vt.c, vc_screen.c and selection.c + */ + +#include <linux/config.h> + +extern int sel_cons; + +extern void clear_selection(void); +extern int set_selection(const unsigned long arg, struct tty_struct *tty, int user); +extern int paste_selection(struct tty_struct *tty); +extern int sel_loadlut(const unsigned long arg); +extern int mouse_reporting(void); +extern void mouse_report(struct tty_struct * tty, int butt, int mrx, int mry); + +#ifdef CONFIG_FB_CONSOLE +extern unsigned long get_video_num_columns(unsigned int console); +extern unsigned long get_video_num_lines(unsigned int console); +extern unsigned long get_video_size_row(unsigned int console); +#else +#define get_video_num_columns(dummy) video_num_columns +#define get_video_num_lines(dummy) video_num_lines +#define get_video_size_row(dummy) video_size_row +#endif + +extern unsigned long video_num_columns; +extern unsigned long video_num_lines; +extern unsigned long video_size_row; +extern unsigned char video_type; +extern unsigned long video_mem_base; +extern unsigned long video_mem_term; +extern unsigned long video_screen_size; +extern unsigned short video_port_reg; +extern unsigned short video_port_val; + +extern int console_blanked; +extern int can_do_color; + +extern unsigned long video_font_height; +extern unsigned long video_scan_lines; +extern unsigned long default_font_height; +extern int video_font_is_default; + +extern unsigned char color_table[]; +extern int default_red[]; +extern int default_grn[]; +extern int default_blu[]; + +extern unsigned short __real_origin; +extern unsigned short __origin; +extern unsigned char has_wrapped; + +extern unsigned short *vc_scrbuf[MAX_NR_CONSOLES]; + +extern void do_unblank_screen(void); +extern unsigned short *screen_pos(int currcons, int w_offset, int viewed); +extern unsigned short screen_word(int currcons, int offset, int viewed); +extern int scrw2glyph(unsigned short scr_word); +extern void complement_pos(int currcons, int offset); +extern void invert_screen(int currcons, int offset, int count, int shift); + +#define reverse_video_char(a) (((a) & 0x88) | ((((a) >> 4) | ((a) << 4)) & 0x77)) +#define reverse_video_short(a) (((a) & 0x88ff) | \ + (((a) & 0x7000) >> 4) | (((a) & 0x0700) << 4)) +/* this latter line used to have masks 0xf000 and 0x0f00, but selection + requires a self-inverse operation; moreover, the old version looks wrong */ + +extern void getconsxy(int currcons, char *p); +extern void putconsxy(int currcons, char *p); + + +/* how to access screen memory */ + +#if defined(CONFIG_TGA_CONSOLE) + +extern int tga_blitc(unsigned int, unsigned long); +extern unsigned long video_mem_term; + +/* + * TGA console screen memory access + * + * TGA is *not* a character/attribute cell device; font bitmaps must be rendered + * to the screen pixels. + * + * We must test for an Alpha kernel virtual address that falls within + * the "shadow screen" memory. This condition indicates we really want + * to write to the screen, so, we do... :-) + * + * NOTE also: there's only *TWO* operations: to put/get a character/attribute. + * All the others needed by VGA support go away, as Not Applicable for TGA. + */ +static inline void scr_writew(unsigned short val, unsigned short * addr) +{ + /* + * always deposit the char/attr, then see if it was to "screen" mem. + * if so, then render the char/attr onto the real screen. + */ + *addr = val; + if ((unsigned long)addr < video_mem_term && + (unsigned long)addr >= video_mem_base) { + tga_blitc(val, (unsigned long) addr); + } +} + +static inline unsigned short scr_readw(unsigned short * addr) +{ + return *addr; +} + +#elif defined (CONFIG_SGI) + +#include <linux/vt_kern.h> +#include <linux/kd.h> +extern void newport_blitc(unsigned short, unsigned long); +extern void memsetw(void * s, unsigned short c, unsigned int count); +extern void memcpyw(unsigned short *to, unsigned short *from, unsigned int count); +extern unsigned long video_mem_term; + +static inline void scr_writew(unsigned short val, unsigned short * addr) +{ + /* always deposit the char/attr, then see if it was to "screen" mem. + * if so, then render the char/attr onto the real screen. + */ + if(*addr != val) { + *addr = val; + if ((unsigned long)addr < video_mem_term && + (unsigned long)addr >= video_mem_base && + vt_cons [fg_console]->vc_mode == KD_TEXT) + newport_blitc(val, (unsigned long) addr); + } +} + +static inline unsigned short scr_readw(unsigned short * addr) +{ + return *addr; +} + +#elif defined (CONFIG_VIDEO_G364) /* The G364 cards: same as above. */ + +extern void g364_blitc(unsigned short, unsigned long); +extern void g364_blitc_colour(unsigned short, unsigned long); +extern unsigned long video_mem_term; + +/* + * G364 console screen memory access + * + * G364 is *not* a character/attribute cell device; font bitmaps must be + * rendered to the screen pixels. + * + * The "unsigned short * addr" is *ALWAYS* a kernel virtual address, either + * of the VC's backing store, or the "shadow screen" memory where the screen + * contents are kept, as the G364 frame buffer is *not* char/attr cells. + * + * We must test for a Mips kernel virtual address that falls within + * the "shadow screen" memory. This condition indicates we really want + * to write to the screen, so, we do... :-) + * + * NOTE also: there's only *TWO* operations: to put/get a character/attribute. + * All the others needed by VGA support go away, as Not Applicable for G364. + */ +static inline void scr_writew(unsigned short val, unsigned short * addr) +{ + /* + * always deposit the char/attr, then see if it was to "screen" mem. + * if so, then render the char/attr onto the real screen. + */ + *addr = val; + if ((unsigned long)addr < video_mem_term && + (unsigned long)addr >= video_mem_base) { + if ((val & 0xff00) == 0x0700) + g364_blitc(val, (unsigned long) addr); /* B&W faster */ + else + g364_blitc_colour(val, (unsigned long) addr); + } +} + +static inline unsigned short scr_readw(unsigned short * addr) +{ + return *addr; +} + +#elif defined(CONFIG_SUN_CONSOLE) + +#include "vt_kern.h" +#include <linux/kd.h> +extern int sun_blitc(unsigned int, unsigned long); +extern void memsetw(void * s, unsigned short c, unsigned int count); +extern void memcpyw(unsigned short *to, unsigned short *from, unsigned int count); +extern unsigned long video_mem_term; + +/* Basically the same as the TGA stuff. */ +static inline void scr_writew(unsigned short val, unsigned short * addr) +{ + /* + * always deposit the char/attr, then see if it was to "screen" mem. + * if so, then render the char/attr onto the real screen. + */ + if (*addr != val) { + *addr = val; + if ((unsigned long)addr < video_mem_term && + (unsigned long)addr >= video_mem_base && + vt_cons [fg_console]->vc_mode == KD_TEXT) + sun_blitc(val, (unsigned long) addr); + } +} + +static inline unsigned short scr_readw(unsigned short * addr) +{ + return *addr; +} + +#else + +/* + * normal VGA console access + * + */ + +#include <asm/io.h> + +/* + * NOTE: "(long) addr < 0" tests for an Alpha kernel virtual address; this + * indicates a VC's backing store; otherwise, it's a bus memory address, for + * the VGA's screen memory, so we do the Alpha "swizzle"... :-) + */ +static inline void scr_writeb(unsigned char val, unsigned char * addr) +{ + if ((long) addr < 0) + *addr = val; + else + writeb(val, (unsigned long) addr); +} + +static inline unsigned char scr_readb(unsigned char * addr) +{ + if ((long) addr < 0) + return *addr; + return readb((unsigned long) addr); +} + +static inline void scr_writew(unsigned short val, unsigned short * addr) +{ + if ((long) addr < 0) + *addr = val; + else + writew(val, (unsigned long) addr); +} + +static inline unsigned short scr_readw(unsigned short * addr) +{ + if ((long) addr < 0) + return *addr; + return readw((unsigned long) addr); +} + +#endif /* CONFIG_TGA_CONSOLE */ + +#if !defined(CONFIG_SUN_CONSOLE) && !defined(CONFIG_SGI) +static inline void memsetw(void * s, unsigned short c, unsigned int count) +{ + unsigned short * addr = (unsigned short *) s; + + count /= 2; + while (count) { + count--; + scr_writew(c, addr++); + } +} + +static inline void memcpyw(unsigned short *to, unsigned short *from, + unsigned int count) +{ + count /= 2; + while (count) { + count--; + scr_writew(scr_readw(from++), to++); + } +} +#endif /* !defined(CONFIG_SUN_CONSOLE) && !defined(CONFIG_SGI) */ diff --git a/include/linux/socket.h b/include/linux/socket.h index 6d0ed9158..96ec54d1d 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -128,7 +128,7 @@ struct ucred #define AF_X25 9 /* Reserved for X.25 project */ #define AF_INET6 10 /* IP version 6 */ #define AF_ROSE 11 /* Amateur Radio X.25 PLP */ -#define AF_DECNET 12 /* Reserved for DECnet project */ +#define AF_DECnet 12 /* Reserved for DECnet project */ #define AF_NETBEUI 13 /* Reserved for 802.2LLC project*/ #define AF_SECURITY 14 /* Security callback pseudo AF */ #define pseudo_AF_KEY 15 /* PF_KEY key management API */ @@ -148,7 +148,7 @@ struct ucred #define PF_X25 AF_X25 #define PF_INET6 AF_INET6 #define PF_ROSE AF_ROSE -#define PF_DECNET AF_DECNET +#define PF_DECnet AF_DECnet #define PF_NETBEUI AF_NETBEUI #define PF_SECURITY AF_SECURITY #define PF_KEY pseudo_AF_KEY diff --git a/include/linux/swap.h b/include/linux/swap.h index b0bdc40b6..56fef7a21 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -66,8 +66,7 @@ extern void swap_in(struct task_struct *, struct vm_area_struct *, /* linux/mm/swap_state.c */ extern void show_swap_cache_info(void); -extern int add_to_swap_cache(unsigned long, unsigned long); -extern unsigned long init_swap_cache(unsigned long, unsigned long); +extern int add_to_swap_cache(struct page *, unsigned long); extern void swap_duplicate(unsigned long); /* linux/mm/swapfile.c */ @@ -90,8 +89,6 @@ extern void swap_free(unsigned long); #define SWAP_CACHE_INFO -extern unsigned long * swap_cache; - #ifdef SWAP_CACHE_INFO extern unsigned long swap_cache_add_total; extern unsigned long swap_cache_add_success; @@ -101,39 +98,37 @@ extern unsigned long swap_cache_find_total; extern unsigned long swap_cache_find_success; #endif -extern inline unsigned long in_swap_cache(unsigned long index) +extern inline unsigned long in_swap_cache(struct page *page) { - return swap_cache[index]; + if (PageSwapCache(page)) + return page->pg_swap_entry; + return 0; } -extern inline long find_in_swap_cache(unsigned long index) +extern inline long find_in_swap_cache(struct page *page) { - unsigned long entry; - #ifdef SWAP_CACHE_INFO swap_cache_find_total++; #endif - entry = xchg(swap_cache + index, 0); + if (PageTestandClearSwapCache(page)) { #ifdef SWAP_CACHE_INFO - if (entry) swap_cache_find_success++; #endif - return entry; + return page->pg_swap_entry; + } + return 0; } -extern inline int delete_from_swap_cache(unsigned long index) +extern inline int delete_from_swap_cache(struct page *page) { - unsigned long entry; - #ifdef SWAP_CACHE_INFO swap_cache_del_total++; #endif - entry = xchg(swap_cache + index, 0); - if (entry) { + if (PageTestandClearSwapCache(page)) { #ifdef SWAP_CACHE_INFO swap_cache_del_success++; #endif - swap_free(entry); + swap_free(page->pg_swap_entry); return 1; } return 0; diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 1840a6fbe..2ec41aa05 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -68,6 +68,8 @@ enum KERN_SPARC_REBOOT, /* reboot command on Sparc */ KERN_CTLALTDEL, /* int: allow ctl-alt-del to reboot */ KERN_PRINTK, /* sturct: control printk logging parameters */ + KERN_NAMETRANS, /* Name translation */ + KERN_STATINODE }; @@ -75,7 +77,6 @@ enum enum { VM_SWAPCTL=1, /* struct: Set vm swapping control */ - VM_KSWAPD, /* struct: control background pageout */ VM_SWAPOUT, /* int: Background pageout interval */ VM_FREEPG, /* struct: Set free page thresholds */ VM_BDFLUSH, /* struct: Control buffer cache flushing */ @@ -100,6 +101,7 @@ enum NET_ROSE, NET_X25, NET_TR, + NET_DECNET }; @@ -110,6 +112,7 @@ enum NET_CORE_RMEM_MAX, NET_CORE_WMEM_DEFAULT, NET_CORE_RMEM_DEFAULT, + NET_CORE_DESTROY_DELAY, }; /* /proc/sys/net/ethernet */ @@ -118,12 +121,19 @@ enum /* /proc/sys/net/unix */ +enum +{ + NET_UNIX_DESTROY_DELAY=1, + NET_UNIX_DELETE_DELAY, +}; + /* /proc/sys/net/ipv4 */ enum { NET_IPV4_ARP_RES_TIME=1, NET_IPV4_ARP_DEAD_RES_TIME, NET_IPV4_ARP_MAX_TRIES, + NET_IPV4_ARP_MAX_PINGS, NET_IPV4_ARP_TIMEOUT, NET_IPV4_ARP_CHECK_INTERVAL, NET_IPV4_ARP_CONFIRM_INTERVAL, @@ -147,9 +157,22 @@ enum NET_IPV4_ACCEPT_REDIRECTS, NET_IPV4_SECURE_REDIRECTS, NET_IPV4_RFC1620_REDIRECTS, - NET_TCP_SYN_RETRIES, - NET_IPFRAG_HIGH_THRESH, - NET_IPFRAG_LOW_THRESH, + NET_IPV4_TCP_SYN_RETRIES, + NET_IPV4_IPFRAG_HIGH_THRESH, + NET_IPV4_IPFRAG_LOW_THRESH, + NET_IPV4_IPFRAG_TIME, + NET_IPV4_TCP_MAX_KA_PROBES, + NET_IPV4_TCP_KEEPALIVE_TIME, + NET_IPV4_TCP_KEEPALIVE_PROBES, + NET_IPV4_TCP_RETRIES1, + NET_IPV4_TCP_RETRIES2, + NET_IPV4_TCP_MAX_DELAY_ACKS, + NET_IPV4_TCP_FIN_TIMEOUT, + NET_IPV4_IGMP_MAX_HOST_REPORT_DELAY, + NET_IPV4_IGMP_TIMER_SCALE, + NET_IPV4_IGMP_AGE_THRESHOLD, + NET_TCP_SYNCOOKIES, + NET_TCP_ALWAYS_SYNCOOKIE, }; @@ -176,7 +199,15 @@ enum { /* /proc/sys/net/ipx */ + /* /proc/sys/net/appletalk */ +enum { + NET_ATALK_AARP_EXPIRY_TIME = 1, + NET_ATALK_AARP_TICK_TIME, + NET_ATALK_AARP_RETRANSMIT_LIMIT, + NET_ATALK_AARP_RESOLVE_TIME, +}; + /* /proc/sys/net/netrom */ enum { @@ -240,6 +271,16 @@ enum NET_TR_RIF_TIMEOUT=1 }; +/* /proc/sys/net/decnet */ +enum { + NET_DECNET_DEF_T3_BROADCAST = 1, + NET_DECNET_DEF_T3_POINTTOPOINT, + NET_DECNET_DEF_T1, + NET_DECNET_DEF_BCT1, + NET_DECNET_CACHETIMEOUT, + NET_DECNET_DEBUG_LEVEL +}; + /* CTL_PROC names: */ /* CTL_FS names: */ @@ -269,6 +310,8 @@ extern int proc_dointvec(ctl_table *, int, struct file *, void *, size_t *); extern int proc_dointvec_minmax(ctl_table *, int, struct file *, void *, size_t *); +extern int proc_dointvec_jiffies(ctl_table *, int, struct file *, + void *, size_t *); extern int do_sysctl (int *name, int nlen, void *oldval, size_t *oldlenp, diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h new file mode 100644 index 000000000..8cfd21b0e --- /dev/null +++ b/include/linux/sysrq.h @@ -0,0 +1,25 @@ +/* -*- linux-c -*- + * + * $Id: sysrq.h,v 1.2 1997/05/31 18:33:41 mj Exp $ + * + * Linux Magic System Request Key Hacks + * + * (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz> + */ + +#include <linux/config.h> + +extern int emergency_sync_scheduled; + +#define EMERG_SYNC 1 +#define EMERG_REMOUNT 2 + +extern void do_emergency_sync(void); + +#ifdef CONFIG_MAGIC_SYSRQ +#define CHECK_EMERGENCY_SYNC \ + if (emergency_sync_scheduled) \ + do_emergency_sync(); +#else +#define CHECK_EMERGENCY_SYNC +#endif diff --git a/include/linux/sysv_fs.h b/include/linux/sysv_fs.h index 7b19dac3c..e68f5d5f1 100644 --- a/include/linux/sysv_fs.h +++ b/include/linux/sysv_fs.h @@ -373,7 +373,7 @@ extern int sysv_symlink(struct inode * inode, const char * name, int len, extern int sysv_link(struct inode * oldinode, struct inode * dir, const char * name, int len); extern int sysv_mknod(struct inode * dir, const char * name, int len, int mode, int rdev); extern int sysv_rename(struct inode * old_dir, const char * old_name, int old_len, - struct inode * new_dir, const char * new_name, int new_len, int must_be_dir); + struct inode * new_dir, const char * new_name, int new_len); extern struct inode * sysv_new_inode(const struct inode * dir); extern void sysv_free_inode(struct inode * inode); extern unsigned long sysv_count_free_inodes(struct super_block *sb); diff --git a/include/linux/umsdos_fs.p b/include/linux/umsdos_fs.p index 333f9940f..f271694c5 100644 --- a/include/linux/umsdos_fs.p +++ b/include/linux/umsdos_fs.p @@ -122,8 +122,7 @@ int UMSDOS_rename (struct inode *old_dir, int old_len, struct inode *new_dir, const char *new_name, - int new_len, - int must_be_dir); + int new_len); /* rdir.c 22/03/95 03.31.42 */ int umsdos_rlookup_x (struct inode *dir, const char *name, diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h new file mode 100644 index 000000000..1692f991c --- /dev/null +++ b/include/linux/vt_kern.h @@ -0,0 +1,39 @@ +#ifndef _VT_KERN_H +#define _VT_KERN_H + +/* + * this really is an extension of the vc_cons structure in console.c, but + * with information needed by the vt package + */ + +#include <linux/vt.h> + +/* + * Presently, a lot of graphics programs do not restore the contents of + * the higher font pages. Defining this flag will avoid use of them, but + * will lose support for PIO_FONTRESET. Note that many font operations are + * not likely to work with these programs anyway; they need to be + * fixed. The linux/Documentation directory includes a code snippet + * to save and restore the text font. + */ +#define BROKEN_GRAPHICS_PROGRAMS 1 + +extern struct vt_struct { + int vc_num; /* The console number */ + unsigned char vc_mode; /* KD_TEXT, ... */ + unsigned char vc_kbdraw; + unsigned char vc_kbde0; + unsigned char vc_kbdleds; + struct vt_mode vt_mode; + int vt_pid; + int vt_newvt; + struct wait_queue *paste_wait; +} *vt_cons[MAX_NR_CONSOLES]; + +void (*kd_mksound)(unsigned int hz, unsigned int ticks); +int vc_allocate(unsigned int console); +int vc_cons_allocated(unsigned int console); +int vc_resize(unsigned long lines, unsigned long cols); +void vc_disallocate(unsigned int console); + +#endif /* _VT_KERN_H */ diff --git a/include/linux/wrapper.h b/include/linux/wrapper.h index 13de8d4ae..750b97084 100644 --- a/include/linux/wrapper.h +++ b/include/linux/wrapper.h @@ -20,9 +20,9 @@ #define module_unregister_blkdev unregister_blkdev #define inode_get_rdev(i) i->i_rdev -#define inode_get_count(i) i->i_count -#define inode_inc_count(i) i->i_count++ -#define inode_dec_count(i) i->i_count-- +#define inode_get_count(i) atomic_read(&((i)->i_count)) +#define inode_inc_count(i) atomic_inc(&((i)->i_count)) +#define inode_dec_count(i) atomic_dec(&((i)->i_count)) #define file_get_flags(f) f->f_flags @@ -35,6 +35,6 @@ #define mem_map_reserve(p) set_bit(PG_reserved, &mem_map[p].flags) #define mem_map_unreserve(p) clear_bit(PG_reserved, &mem_map[p].flags) -#define mem_map_inc_count(p) mem_map[p].count++ -#define mem_map_dec_count(p) mem_map[p].count-- +#define mem_map_inc_count(p) atomic_inc(&(mem_map[p].count)) +#define mem_map_dec_count(p) atomic_dec(&(mem_map[p].count)) #endif diff --git a/include/net/checksum.h b/include/net/checksum.h index 2fb596b13..19dea08ea 100644 --- a/include/net/checksum.h +++ b/include/net/checksum.h @@ -26,6 +26,7 @@ #ifndef _CHECKSUM_H #define _CHECKSUM_H +#include <asm/types.h> #include <asm/byteorder.h> #include <net/ip.h> #include <asm/checksum.h> diff --git a/include/net/sock.h b/include/net/sock.h index a25907b19..a6035bd57 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -70,6 +70,10 @@ #include <linux/atalk.h> #endif +#if defined(CONFIG_DECNET) || defined(CONFIG_DECNET_MODULE) +#include <net/dn.h> +#endif + #include <linux/igmp.h> #include <asm/atomic.h> @@ -447,6 +451,7 @@ struct sock union { + void *destruct_hook; struct unix_opt af_unix; #if defined(CONFIG_ATALK) || defined(CONFIG_ATALK_MODULE) struct atalk_sock af_at; @@ -472,6 +477,9 @@ struct sock rose_cb *rose; #endif #endif +#if defined(CONFIG_DECNET) || defined(CONFIG_DECNET_MODULE) + dn_cb *dn; +#endif } protinfo; /* @@ -523,6 +531,7 @@ struct sock int (*backlog_rcv) (struct sock *sk, struct sk_buff *skb); + void (*destruct)(struct sock *sk); }; /* |