diff options
Diffstat (limited to 'arch')
67 files changed, 673 insertions, 760 deletions
diff --git a/arch/alpha/config.in b/arch/alpha/config.in index 7441083b6..687994802 100644 --- a/arch/alpha/config.in +++ b/arch/alpha/config.in @@ -228,6 +228,8 @@ tristate 'Kernel support for Linux/Intel ELF binaries' CONFIG_BINFMT_EM86 source drivers/parport/Config.in endmenu +source drivers/mtd/Config.in + source drivers/pnp/Config.in source drivers/block/Config.in diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index d55af89c6..fd5c2b5e1 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c @@ -146,7 +146,6 @@ asmlinkage int osf_getdirentries(unsigned int fd, struct osf_dirent *dirent, buf.count = count; buf.error = 0; - lock_kernel(); error = vfs_readdir(file, osf_filldir, &buf); if (error < 0) goto out_putf; @@ -156,7 +155,6 @@ asmlinkage int osf_getdirentries(unsigned int fd, struct osf_dirent *dirent, error = count - buf.count; out_putf: - unlock_kernel(); fput(file); out: return error; @@ -230,7 +228,6 @@ asmlinkage unsigned long osf_mmap(unsigned long addr, unsigned long len, struct file *file = NULL; unsigned long ret = -EBADF; - lock_kernel(); #if 0 if (flags & (_MAP_HASSEMAPHORE | _MAP_INHERIT | _MAP_UNALIGNED)) printk("%s: unimplemented OSF mmap flags %04lx\n", @@ -248,7 +245,6 @@ asmlinkage unsigned long osf_mmap(unsigned long addr, unsigned long len, if (file) fput(file); out: - unlock_kernel(); return ret; } @@ -320,9 +316,7 @@ asmlinkage int osf_fstatfs(unsigned long fd, struct osf_statfs *buffer, unsigned retval = -EBADF; file = fget(fd); if (file) { - lock_kernel(); retval = do_osf_statfs(file->f_dentry, buffer, bufsiz); - unlock_kernel(); fput(file); } return retval; @@ -491,14 +485,12 @@ asmlinkage int sys_pipe(int a0, int a1, int a2, int a3, int a4, int a5, int fd[2]; int error; - lock_kernel(); error = do_pipe(fd); if (error) goto out; (®s)->r20 = fd[1]; error = fd[0]; out: - unlock_kernel(); return error; } diff --git a/arch/alpha/vmlinux.lds b/arch/alpha/vmlinux.lds deleted file mode 100644 index f64a926b6..000000000 --- a/arch/alpha/vmlinux.lds +++ /dev/null @@ -1,88 +0,0 @@ -OUTPUT_FORMAT("elf64-alpha") -ENTRY(__start) -SECTIONS -{ - . = 0xfffffc0000810000; - _text = .; - .text : { *(.text) } - _etext = .; - - /* Exception table */ - . = ALIGN(16); - __start___ex_table = .; - __ex_table : { *(__ex_table) } - __stop___ex_table = .; - - /* Kernel symbol table */ - . = ALIGN(8); - __start___ksymtab = .; - __ksymtab : { *(__ksymtab) } - __stop___ksymtab = .; - .kstrtab : { *(.kstrtab) } - - /* Startup code */ - . = ALIGN(8192); - __init_begin = .; - .text.init : { *(.text.init) } - .data.init : { *(.data.init) } - - . = ALIGN(16); - __setup_start = .; - .setup.init : { *(.setup.init) } - __setup_end = .; - - . = ALIGN(8); - __initcall_start = .; - .initcall.init : { *(.initcall.init) } - __initcall_end = .; - - . = ALIGN(2*8192); /* Align double page for init_task_union */ - __init_end = .; - - /* The initial task and kernel stack */ - init_task : { *(init_task) } - - /* Global data */ - _data = .; - .data.cacheline_aligned : { *(.data.cacheline_aligned) } - .rodata : { *(.rodata) } - .data : { *(.data) CONSTRUCTORS } - .got : { *(.got) } - .sdata : { *(.sdata) } - _edata = .; - - __bss_start = .; - .sbss : { *(.sbss) *(.scommon) } - .bss : { *(.bss) *(COMMON) } - __bss_stop = .; - _end = .; - - .mdebug 0 : { *(.mdebug) } - .note 0 : { *(.note) } - .comment 0 : { *(.comment) } - - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - - /DISCARD/ : { *(.text.exit) *(.data.exit) } -} diff --git a/arch/arm/config.in b/arch/arm/config.in index 15fba3403..e270007f9 100644 --- a/arch/arm/config.in +++ b/arch/arm/config.in @@ -271,6 +271,8 @@ if [ "$CONFIG_SCSI" != "n" ]; then fi endmenu +source drivers/mtd/Config.in + source drivers/ieee1394/Config.in source drivers/i2o/Config.in diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c index 93c539ffd..e1617fbaa 100644 --- a/arch/arm/kernel/sys_arm.c +++ b/arch/arm/kernel/sys_arm.c @@ -39,9 +39,7 @@ asmlinkage int sys_pipe(unsigned long * fildes) int fd[2]; int error; - lock_kernel(); error = do_pipe(fd); - unlock_kernel(); if (!error) { if (copy_to_user(fildes, fd, 2*sizeof(int))) error = -EFAULT; @@ -66,11 +64,7 @@ inline long do_mmap2( } down(¤t->mm->mmap_sem); - lock_kernel(); - error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); - - unlock_kernel(); up(¤t->mm->mmap_sem); if (file) diff --git a/arch/i386/boot/compressed/head.S b/arch/i386/boot/compressed/head.S index f016493ba..df1fbff85 100644 --- a/arch/i386/boot/compressed/head.S +++ b/arch/i386/boot/compressed/head.S @@ -43,6 +43,7 @@ startup_32: movl %eax,0x000000 # loop forever if it isn't cmpl %eax,0x100000 je 1b + /* * Initialize eflags. Some BIOS's leave bits like NT set. This would * confuse the debugger if this code is traced. @@ -64,10 +65,14 @@ startup_32: * Do the decompression, and jump to the new kernel.. */ subl $16,%esp # place for structure on the stack - pushl %esp # address of structure as first arg + movl %esp,%eax + pushl %esi # real mode pointer as second arg + pushl %eax # address of structure as first arg call SYMBOL_NAME(decompress_kernel) orl %eax,%eax jnz 3f + popl %esi # discard address + popl %esi # real mode pointer xorl %ebx,%ebx ljmp $(__KERNEL_CS), $0x100000 @@ -82,11 +87,14 @@ startup_32: movl $0x1000,%edi movl $move_routine_end,%ecx subl %esi,%ecx + addl $3,%ecx + shrl $2,%ecx cld rep - movsb + movsl popl %esi # discard the address + popl %ebx # real mode pointer popl %esi # low_buffer_start popl %ecx # lcount popl %edx # high_buffer_start @@ -100,18 +108,21 @@ startup_32: * if we were high loaded. This _must_ PIC-code ! */ move_routine_start: + movl %ecx,%ebp + shrl $2,%ecx + rep + movsl + movl %ebp,%ecx + andl $3,%ecx rep movsb movl %edx,%esi movl %eax,%ecx # NOTE: rep movsb won't move if %ecx == 0 + addl $3,%ecx + shrl $2,%ecx rep - movsb + movsl + movl %ebx,%esi # Restore setup pointer xorl %ebx,%ebx -/* - * Well, the kernel relies on %esp pointing into low mem, - * with the decompressor loaded high this is no longer true, - * so we set esp here. - */ - mov $0x90000,%esp ljmp $(__KERNEL_CS), $0x100000 move_routine_end: diff --git a/arch/i386/boot/compressed/misc.c b/arch/i386/boot/compressed/misc.c index 055b3ea5b..15d6e4f6a 100644 --- a/arch/i386/boot/compressed/misc.c +++ b/arch/i386/boot/compressed/misc.c @@ -73,11 +73,13 @@ static void gzip_release(void **); /* * This is set up by the setup-routine at boot-time */ -#define EXT_MEM_K (*(unsigned short *)0x90002) +static unsigned char *real_mode; /* Pointer to real-mode data */ + +#define EXT_MEM_K (*(unsigned short *)(real_mode + 0x2)) #ifndef STANDARD_MEMORY_BIOS_CALL -#define ALT_MEM_K (*(unsigned long *) 0x901e0) +#define ALT_MEM_K (*(unsigned long *)(real_mode + 0x1e0)) #endif -#define SCREEN_INFO (*(struct screen_info *)0x90000) +#define SCREEN_INFO (*(struct screen_info *)(real_mode+0)) extern char input_data[]; extern int input_len; @@ -97,13 +99,13 @@ static void puts(const char *); extern int end; static long free_mem_ptr = (long)&end; -static long free_mem_end_ptr = 0x90000; - +static long free_mem_end_ptr; + #define INPLACE_MOVE_ROUTINE 0x1000 #define LOW_BUFFER_START 0x2000 -#define LOW_BUFFER_END 0x90000 -#define LOW_BUFFER_SIZE ( LOW_BUFFER_END - LOW_BUFFER_START ) +#define LOW_BUFFER_MAX 0x90000 #define HEAP_SIZE 0x3000 +static unsigned int low_buffer_end, low_buffer_size; static int high_loaded =0; static uch *high_buffer_start /* = (uch *)(((ulg)&end) + HEAP_SIZE)*/; @@ -256,7 +258,7 @@ static void flush_window_high(void) in = window; for (n = 0; n < outcnt; n++) { ch = *output_data++ = *in++; - if ((ulg)output_data == LOW_BUFFER_END) output_data=high_buffer_start; + if ((ulg)output_data == low_buffer_end) output_data=high_buffer_start; c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); } crc = c; @@ -312,10 +314,13 @@ void setup_output_buffer_if_we_run_high(struct moveparams *mv) if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < (3*1024)) error("Less than 4MB of memory.\n"); #endif mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START; + low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX + ? LOW_BUFFER_MAX : (unsigned int)real_mode) & ~0xfff; + low_buffer_size = low_buffer_end - LOW_BUFFER_START; high_loaded = 1; free_mem_end_ptr = (long)high_buffer_start; - if ( (0x100000 + LOW_BUFFER_SIZE) > ((ulg)high_buffer_start)) { - high_buffer_start = (uch *)(0x100000 + LOW_BUFFER_SIZE); + if ( (0x100000 + low_buffer_size) > ((ulg)high_buffer_start)) { + high_buffer_start = (uch *)(0x100000 + low_buffer_size); mv->hcount = 0; /* say: we need not to move high_buffer */ } else mv->hcount = -1; @@ -324,17 +329,21 @@ void setup_output_buffer_if_we_run_high(struct moveparams *mv) void close_output_buffer_if_we_run_high(struct moveparams *mv) { - mv->lcount = bytes_out; - if (bytes_out > LOW_BUFFER_SIZE) { - mv->lcount = LOW_BUFFER_SIZE; - if (mv->hcount) mv->hcount = bytes_out - LOW_BUFFER_SIZE; + if (bytes_out > low_buffer_size) { + mv->lcount = low_buffer_size; + if (mv->hcount) + mv->hcount = bytes_out - low_buffer_size; + } else { + mv->lcount = bytes_out; + mv->hcount = 0; } - else mv->hcount = 0; } -int decompress_kernel(struct moveparams *mv) +int decompress_kernel(struct moveparams *mv, void *rmode) { + real_mode = rmode; + if (SCREEN_INFO.orig_video_mode == 7) { vidmem = (char *) 0xb0000; vidport = 0x3b4; @@ -356,4 +365,3 @@ int decompress_kernel(struct moveparams *mv) if (high_loaded) close_output_buffer_if_we_run_high(mv); return high_loaded; } - diff --git a/arch/i386/boot/setup.S b/arch/i386/boot/setup.S index 7c50d54a8..cfb9011d3 100644 --- a/arch/i386/boot/setup.S +++ b/arch/i386/boot/setup.S @@ -70,7 +70,7 @@ start: # This is the setup header, and it must start at %cs:2 (old 0x9020:2) .ascii "HdrS" # header signature - .word 0x0201 # header version number (>= 0x0105) + .word 0x0202 # header version number (>= 0x0105) # or else old loadlin-1.5 will fail) realmode_swtch: .word 0, 0 # default_switch, SETUPSEG start_sys_seg: .word SYSSEG @@ -128,9 +128,27 @@ ramdisk_size: .long 0 # its size in bytes bootsect_kludge: .word bootsect_helper, SETUPSEG -heap_end_ptr: .word modelist+1024 # space from here (exclusive) down to +heap_end_ptr: .word modelist+1024 # (Header version 0x0201 or later) + # space from here (exclusive) down to # end of setup code can be used by setup # for local heap purposes. + +pad1: .word 0 +cmd_line_ptr: .long 0 # (Header version 0x0202 or later) + # If nonzero, a 32-bit pointer + # to the kernel command line. + # The command line should be + # located between the start of + # setup and the end of low + # memory (0xa0000), or it may + # get overwritten before it + # gets read. If this field is + # used, there is no longer + # anything magical about the + # 0x90000 segment; the setup + # can be located anywhere in + # low memory 0x10000 or higher. + trampoline: call start_of_setup .space 1024 # End of setup header ##################################################### @@ -551,7 +569,14 @@ end_move: # then we load the segment descriptors movw %cs, %ax # aka SETUPSEG movw %ax, %ds - + +# Check whether we need to be downward compatible with version <=201 + cmpl $0, cmd_line_ptr + jne end_move_self # loader uses version >=202 features + cmpb $0x20, type_of_loader + je end_move_self # bootsect loader, we know of it + +# Boot loader doesnt support boot protocol version 2.02. # If we have our code not at 0x90000, we need to move it there now. # We also then need to move the params behind it (commandline) # Because we would overwrite the code on the current IP, we move @@ -597,6 +622,11 @@ move_self_here: movw %dx, %ss end_move_self: # now we are at the right place lidt idt_48 # load idt with 0,0 + xorl %eax, %eax # Compute gdt_base + movw %ds, %ax # (Convert %ds:gdt to a linear ptr) + shll $4, %eax + addl $gdt, %eax + movl %eax, (gdt_48+2) lgdt gdt_48 # load gdt with whatever is # appropriate @@ -615,8 +645,7 @@ end_move_self: # now we are at the right place # time on certain systems; Toshiba Tecras are known to have this # problem. The memory location used here (0x200) is the int 0x80 # vector, which should be safe to use. - push %ds - push %es + xorw %ax, %ax # segment 0x0000 movw %ax, %fs decw %ax # segment 0xffff (HMA) @@ -663,7 +692,10 @@ a20_wait: flush_instr: xorw %bx, %bx # Flag to indicate a boot - + xorl %esi, %esi # Pointer to real-mode code + movw %cs, %si + subw $DELTA_INITSEG, %si + shll $4, %esi # Convert to 32-bit pointer # NOTE: For high loaded big kernels we need a # jmpi 0x100000,__KERNEL_CS # @@ -852,7 +884,7 @@ gdt_48: .word 0x8000 # gdt limit=2048, # 256 GDT entries - .word 512+gdt, 0x9 # gdt base = 0X9xxxx + .word 0, 0 # gdt base (filled in later) # Include video setup & detection code diff --git a/arch/i386/config.in b/arch/i386/config.in index c8af53dea..81cd0241d 100644 --- a/arch/i386/config.in +++ b/arch/i386/config.in @@ -209,9 +209,10 @@ tristate 'Kernel support for MISC binaries' CONFIG_BINFMT_MISC bool 'Power Management support' CONFIG_PM -dep_tristate ' ACPI support' CONFIG_ACPI $CONFIG_PM +bool ' ACPI support' CONFIG_ACPI $CONFIG_PM if [ "$CONFIG_ACPI" != "n" ]; then if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then + bool ' ACPI interpreter (EXPERIMENTAL)' CONFIG_ACPI_INTERPRETER bool ' Enter S1 for sleep (EXPERIMENTAL)' CONFIG_ACPI_S1_SLEEP fi fi @@ -230,6 +231,8 @@ fi endmenu +source drivers/mtd/Config.in + source drivers/parport/Config.in source drivers/pnp/Config.in diff --git a/arch/i386/defconfig b/arch/i386/defconfig index 638d5df84..ee4f04c6a 100644 --- a/arch/i386/defconfig +++ b/arch/i386/defconfig @@ -91,6 +91,11 @@ CONFIG_ACPI=y # CONFIG_APM is not set # +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# # Parallel port support # # CONFIG_PARPORT is not set @@ -506,6 +511,7 @@ CONFIG_AUTOFS4_FS=y # CONFIG_UMSDOS_FS is not set # CONFIG_VFAT_FS is not set # CONFIG_EFS_FS is not set +# CONFIG_JFFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set CONFIG_ISO9660_FS=y diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile index ce167928b..d1388eec3 100644 --- a/arch/i386/kernel/Makefile +++ b/arch/i386/kernel/Makefile @@ -35,13 +35,17 @@ obj-$(CONFIG_MTRR) += mtrr.o obj-$(CONFIG_X86_MSR) += msr.o obj-$(CONFIG_X86_CPUID) += cpuid.o obj-$(CONFIG_MICROCODE) += microcode.o -obj-$(CONFIG_ACPI) += acpi.o obj-$(CONFIG_APM) += apm.o obj-$(CONFIG_SMP) += smp.o smpboot.o trampoline.o obj-$(CONFIG_X86_LOCAL_APIC) += apic.o obj-$(CONFIG_X86_IO_APIC) += io_apic.o mpparse.o obj-$(CONFIG_X86_VISWS_APIC) += visws_apic.o +# if the interpreter is used, it overrides acpi.c +ifneq ($(CONFIG_ACPI_INTERPRETER),y) +obj-$(CONFIG_ACPI) += acpi.o +endif + O_OBJS := $(filter-out $(export-objs), $(obj-y)) OX_OBJS := $(filter $(export-objs), $(obj-y)) M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m))) diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c index 100a5ba5a..88d571654 100644 --- a/arch/i386/kernel/apic.c +++ b/arch/i386/kernel/apic.c @@ -5,8 +5,9 @@ * * Fixes * Maciej W. Rozycki : Bits for genuine 82489DX APICs; - * thanks to Eric Gilmore for - * testing these extensively + * thanks to Eric Gilmore + * and Rolf G. Tews + * for testing these extensively */ #include <linux/config.h> diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S index 51ab1c8ca..fdb488a15 100644 --- a/arch/i386/kernel/head.S +++ b/arch/i386/kernel/head.S @@ -16,11 +16,11 @@ #include <asm/pgtable.h> #include <asm/desc.h> - -#define CL_MAGIC_ADDR 0x90020 -#define CL_MAGIC 0xA33F -#define CL_BASE_ADDR 0x90000 -#define CL_OFFSET 0x90022 +#define OLD_CL_MAGIC_ADDR 0x90020 +#define OLD_CL_MAGIC 0xA33F +#define OLD_CL_BASE_ADDR 0x90000 +#define OLD_CL_OFFSET 0x90022 +#define NEW_CL_POINTER 0x228 /* Relative to real mode data */ /* * References to members of the boot_cpu_data structure. @@ -38,6 +38,8 @@ /* * swapper_pg_dir is the main page directory, address 0x00101000 + * + * On entry, %esi points to the real-mode code as a 32-bit pointer. */ ENTRY(stext) ENTRY(_stext) @@ -54,6 +56,7 @@ startup_32: #ifdef CONFIG_SMP orw %bx,%bx jz 1f + /* * New page tables may be in 4Mbyte page mode and may * be using the global pages. @@ -113,6 +116,7 @@ startup_32: jmp checkCPUtype 1: #endif CONFIG_SMP + /* * Clear BSS first so that there are no surprises... */ @@ -123,6 +127,7 @@ startup_32: cld rep stosb + /* * start system 32-bit setup. We need to re-do some of the things done * in 16-bit mode for the "real" operations. @@ -139,8 +144,9 @@ startup_32: * Copy bootup parameters out of the way. First 2kB of * _empty_zero_page is for boot parameters, second 2kB * is for the command line. + * + * Note: %esi still has the pointer to the real-mode data. */ - movl $0x90000,%esi movl $ SYMBOL_NAME(empty_zero_page),%edi movl $512,%ecx cld @@ -150,11 +156,15 @@ startup_32: movl $512,%ecx rep stosl - cmpw $(CL_MAGIC),CL_MAGIC_ADDR + movl SYMBOL_NAME(empty_zero_page)+NEW_CL_POINTER,%esi + andl %esi,%esi + jnz 2f # New command line protocol + cmpw $(OLD_CL_MAGIC),OLD_CL_MAGIC_ADDR jne 1f + movzwl OLD_CL_OFFSET,%esi + addl $(OLD_CL_BASE_ADDR),%esi +2: movl $ SYMBOL_NAME(empty_zero_page)+2048,%edi - movzwl CL_OFFSET,%esi - addl $(CL_BASE_ADDR),%esi movl $512,%ecx rep movsl @@ -455,7 +465,7 @@ ENTRY(gdt_table) .quad 0x00009a0000000000 /* 0x50 APM CS 16 code (16 bit) */ .quad 0x0040920000000000 /* 0x58 APM DS data */ .fill NR_CPUS*4,8,0 /* space for TSS's and LDT's */ - + /* * This is to aid debugging, the various locking macros will be putting * code fragments here. When an oops occurs we'd rather know that it's diff --git a/arch/i386/kernel/i8259.c b/arch/i386/kernel/i8259.c index 735c226b1..905f694ce 100644 --- a/arch/i386/kernel/i8259.c +++ b/arch/i386/kernel/i8259.c @@ -363,6 +363,8 @@ void __init init_8259A(int auto_eoi) * when acking. */ i8259A_irq_type.ack = disable_8259A_irq; + else + i8259A_irq_type.ack = mask_and_ack_8259A; udelay(100); /* wait for 8259A to initialize */ diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index a9975576e..ff0db7ca3 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c @@ -14,8 +14,9 @@ * * Fixes * Maciej W. Rozycki : Bits for genuine 82489DX APICs; - * thanks to Eric Gilmore for - * testing these extensively + * thanks to Eric Gilmore + * and Rolf G. Tews + * for testing these extensively */ #include <linux/mm.h> @@ -26,6 +27,7 @@ #include <linux/sched.h> #include <linux/config.h> #include <linux/smp_lock.h> +#include <linux/mc146818rtc.h> #include <asm/io.h> #include <asm/smp.h> @@ -227,9 +229,9 @@ static int __init find_irq_entry(int apic, int pin, int type) } /* - * Find the pin to which IRQ0 (ISA) is connected + * Find the pin to which IRQ[irq] (ISA) is connected */ -static int __init find_timer_pin(int type) +static int __init find_isa_irq_pin(int irq, int type) { int i; @@ -240,7 +242,7 @@ static int __init find_timer_pin(int type) mp_bus_id_to_type[lbus] == MP_BUS_EISA || mp_bus_id_to_type[lbus] == MP_BUS_MCA) && (mp_irqs[i].mpc_irqtype == type) && - (mp_irqs[i].mpc_srcbusirq == 0x00)) + (mp_irqs[i].mpc_srcbusirq == irq)) return mp_irqs[i].mpc_dstirq; } @@ -1246,6 +1248,22 @@ static inline void init_IO_APIC_traps(void) } } +static void enable_lapic_irq (unsigned int irq) +{ + unsigned long v; + + v = apic_read(APIC_LVT0); + apic_write_around(APIC_LVT0, v & ~APIC_LVT_MASKED); +} + +static void disable_lapic_irq (unsigned int irq) +{ + unsigned long v; + + v = apic_read(APIC_LVT0); + apic_write_around(APIC_LVT0, v | APIC_LVT_MASKED); +} + static void ack_lapic_irq (unsigned int irq) { ack_APIC_irq(); @@ -1257,8 +1275,8 @@ static struct hw_interrupt_type lapic_irq_type = { "local-APIC-edge", NULL, /* startup_irq() not used for IRQ0 */ NULL, /* shutdown_irq() not used for IRQ0 */ - NULL, /* enable_irq() not used for IRQ0 */ - NULL, /* disable_irq() not used for IRQ0 */ + enable_lapic_irq, + disable_lapic_irq, ack_lapic_irq, end_lapic_irq }; @@ -1295,6 +1313,61 @@ static void setup_nmi (void) } /* + * This looks a bit hackish but it's about the only one way of sending + * a few INTA cycles to 8259As and any associated glue logic. ICR does + * not support the ExtINT mode, unfortunately. We need to send these + * cycles as some i82489DX-based boards have glue logic that keeps the + * 8259A interrupt line asserted until INTA. --macro + */ +static inline void unlock_ExtINT_logic(void) +{ + int pin, i; + struct IO_APIC_route_entry entry0, entry1; + unsigned char save_control, save_freq_select; + + pin = find_isa_irq_pin(8, mp_INT); + if (pin == -1) + return; + + *(((int *)&entry0) + 1) = io_apic_read(0, 0x11 + 2 * pin); + *(((int *)&entry0) + 0) = io_apic_read(0, 0x10 + 2 * pin); + clear_IO_APIC_pin(0, pin); + + memset(&entry1, 0, sizeof(entry1)); + + entry1.dest_mode = 0; /* physical delivery */ + entry1.mask = 0; /* unmask IRQ now */ + entry1.dest.physical.physical_dest = hard_smp_processor_id(); + entry1.delivery_mode = dest_ExtINT; + entry1.polarity = entry0.polarity; + entry1.trigger = 0; + entry1.vector = 0; + + io_apic_write(0, 0x11 + 2 * pin, *(((int *)&entry1) + 1)); + io_apic_write(0, 0x10 + 2 * pin, *(((int *)&entry1) + 0)); + + save_control = CMOS_READ(RTC_CONTROL); + save_freq_select = CMOS_READ(RTC_FREQ_SELECT); + CMOS_WRITE((save_freq_select & ~RTC_RATE_SELECT) | 0x6, + RTC_FREQ_SELECT); + CMOS_WRITE(save_control | RTC_PIE, RTC_CONTROL); + + i = 100; + while (i-- > 0) { + mdelay(10); + if ((CMOS_READ(RTC_INTR_FLAGS) & RTC_PF) == RTC_PF) + i -= 10; + } + + CMOS_WRITE(save_control, RTC_CONTROL); + CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); + clear_IO_APIC_pin(0, pin); + + io_apic_write(0, 0x11 + 2 * pin, *(((int *)&entry0) + 1)); + io_apic_write(0, 0x10 + 2 * pin, *(((int *)&entry0) + 0)); +} + +/* * This code may look a bit paranoid, but it's supposed to cooperate with * a wide range of boards and BIOS bugs. Fortunately only the timer IRQ * is so screwy. Thanks to Brian Perkins for testing/hacking this beast @@ -1325,8 +1398,8 @@ static inline void check_timer(void) timer_ack = 1; enable_8259A_irq(0); - pin1 = find_timer_pin(mp_INT); - pin2 = find_timer_pin(mp_ExtINT); + pin1 = find_isa_irq_pin(0, mp_INT); + pin2 = find_isa_irq_pin(0, mp_ExtINT); printk(KERN_INFO "..TIMER: vector=%d pin1=%d pin2=%d\n", vector, pin1, pin2); @@ -1386,6 +1459,21 @@ static inline void check_timer(void) printk(" works.\n"); return; } + apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector); + printk(" failed.\n"); + + printk(KERN_INFO "...trying to set up timer as ExtINT IRQ..."); + + init_8259A(0); + make_8259A_irq(0); + apic_write_around(APIC_LVT0, APIC_DM_EXTINT); + + unlock_ExtINT_logic(); + + if (timer_irq_works()) { + printk(" works.\n"); + return; + } printk(" failed :(.\n"); panic("IO-APIC + timer doesn't work! pester mingo@redhat.com"); } diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c index 0da172ad4..bddac2a1d 100644 --- a/arch/i386/kernel/process.c +++ b/arch/i386/kernel/process.c @@ -344,7 +344,7 @@ void machine_power_off(void) void show_regs(struct pt_regs * regs) { - long cr0 = 0L, cr2 = 0L, cr3 = 0L; + unsigned long cr0 = 0L, cr2 = 0L, cr3 = 0L, cr4 = 0L; printk("\n"); printk("EIP: %04x:[<%08lx>]",0xffff & regs->xcs,regs->eip); @@ -361,7 +361,14 @@ void show_regs(struct pt_regs * regs) __asm__("movl %%cr0, %0": "=r" (cr0)); __asm__("movl %%cr2, %0": "=r" (cr2)); __asm__("movl %%cr3, %0": "=r" (cr3)); - printk("CR0: %08lx CR2: %08lx CR3: %08lx\n", cr0, cr2, cr3); + /* This could fault if %cr4 does not exist */ + __asm__("1: movl %%cr4, %0 \n" + "2: \n" + ".section __ex_table,\"a\" \n" + ".long 1b,2b \n" + ".previous \n" + : "=r" (cr4): "0" (0)); + printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4); } /* diff --git a/arch/i386/kernel/sys_i386.c b/arch/i386/kernel/sys_i386.c index 362ee64c0..21a941be6 100644 --- a/arch/i386/kernel/sys_i386.c +++ b/arch/i386/kernel/sys_i386.c @@ -31,9 +31,7 @@ asmlinkage int sys_pipe(unsigned long * fildes) int fd[2]; int error; - lock_kernel(); error = do_pipe(fd); - unlock_kernel(); if (!error) { if (copy_to_user(fildes, fd, 2*sizeof(int))) error = -EFAULT; @@ -58,11 +56,7 @@ static inline long do_mmap2( } down(¤t->mm->mmap_sem); - lock_kernel(); - error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); - - unlock_kernel(); up(¤t->mm->mmap_sem); if (file) diff --git a/arch/i386/math-emu/poly_tan.c b/arch/i386/math-emu/poly_tan.c index 13a32b9fc..251f00455 100644 --- a/arch/i386/math-emu/poly_tan.c +++ b/arch/i386/math-emu/poly_tan.c @@ -89,7 +89,7 @@ void poly_tan(FPU_REG *st0_ptr) { FPU_settag0(TAG_Valid); significand(st0_ptr) = 0x8a51e04daabda360LL; - setexponent16(st0_ptr, 0x41 + EXTENDED_Ebias | SIGN_Negative); + setexponent16(st0_ptr, (0x41 + EXTENDED_Ebias) | SIGN_Negative); return; } diff --git a/arch/i386/vmlinux.lds b/arch/i386/vmlinux.lds index 5790bb5d4..da64e9aa3 100644 --- a/arch/i386/vmlinux.lds +++ b/arch/i386/vmlinux.lds @@ -68,6 +68,7 @@ SECTIONS /DISCARD/ : { *(.text.exit) *(.data.exit) + *(.exitcall.exit) } /* Stabs debugging sections. */ diff --git a/arch/ia64/config.in b/arch/ia64/config.in index b9991cfef..e17fbd6af 100644 --- a/arch/ia64/config.in +++ b/arch/ia64/config.in @@ -85,6 +85,7 @@ source drivers/parport/Config.in endmenu +source drivers/mtd/Config.in source drivers/pnp/Config.in source drivers/block/Config.in source drivers/i2o/Config.in diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c index bd925c0e4..95f8b1f54 100644 --- a/arch/ia64/ia32/sys_ia32.c +++ b/arch/ia64/ia32/sys_ia32.c @@ -111,12 +111,10 @@ int stack) * `munmap' if the `execve' failes. */ down(¤t->mm->mmap_sem); - lock_kernel(); av = (char **) do_mmap_pgoff(0, 0UL, len, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0); - unlock_kernel(); up(¤t->mm->mmap_sem); if (IS_ERR(av)) @@ -258,11 +256,15 @@ do_mmap_fake(struct file *file, unsigned long addr, unsigned long len, return -EINVAL; if (!file->f_op->read) return -EINVAL; + lock_kernel(); if (file->f_op->llseek) { - if (file->f_op->llseek(file,off,0) != off) + if (file->f_op->llseek(file,off,0) != off) { + unlock_kernel(); return -EINVAL; + } } else file->f_pos = off; + unlock_kernel(); r = file->f_op->read(file, (char *)addr, len, &file->f_pos); return (r < 0) ? -EINVAL : addr; } @@ -292,7 +294,6 @@ sys32_mmap(struct mmap_arg_struct *arg) if (copy_from_user(&a, arg, sizeof(a))) return -EFAULT; - lock_kernel(); if (!(a.flags & MAP_ANONYMOUS)) { error = -EBADF; file = fget(a.fd); @@ -302,9 +303,7 @@ sys32_mmap(struct mmap_arg_struct *arg) a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); if ((a.flags & MAP_FIXED) && ((a.addr & ~PAGE_MASK) || (a.offset & ~PAGE_MASK))) { - unlock_kernel(); error = do_mmap_fake(file, a.addr, a.len, a.prot, a.flags, a.offset); - lock_kernel(); } else { down(¤t->mm->mmap_sem); error = do_mmap(file, a.addr, a.len, a.prot, a.flags, a.offset); @@ -313,7 +312,6 @@ sys32_mmap(struct mmap_arg_struct *arg) if (file) fput(file); out: - unlock_kernel(); return error; } @@ -323,14 +321,12 @@ sys32_pipe(int *fd) int retval; int fds[2]; - lock_kernel(); retval = do_pipe(fds); if (retval) goto out; if (copy_to_user(fd, fds, sizeof(fds))) retval = -EFAULT; out: - unlock_kernel(); return retval; } diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c index cd9d64fce..c25193cdc 100644 --- a/arch/ia64/kernel/sys_ia64.c +++ b/arch/ia64/kernel/sys_ia64.c @@ -83,14 +83,12 @@ sys_pipe (long arg0, long arg1, long arg2, long arg3, int fd[2]; int retval; - lock_kernel(); retval = do_pipe(fd); if (retval) goto out; retval = fd[0]; regs->r9 = fd[1]; out: - unlock_kernel(); return retval; } @@ -132,11 +130,7 @@ do_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, un } down(¤t->mm->mmap_sem); - lock_kernel(); - addr = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); - - unlock_kernel(); up(¤t->mm->mmap_sem); if (file) diff --git a/arch/m68k/config.in b/arch/m68k/config.in index ab67c8a46..bde3a370a 100644 --- a/arch/m68k/config.in +++ b/arch/m68k/config.in @@ -145,6 +145,8 @@ if [ "$CONFIG_MODULES" = "y" ]; then fi endmenu +source drivers/mtd/Config.in + source drivers/block/Config.in if [ "$CONFIG_NET" = "y" ]; then diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c index 8e9c89716..86637d4d6 100644 --- a/arch/m68k/kernel/sys_m68k.c +++ b/arch/m68k/kernel/sys_m68k.c @@ -34,13 +34,11 @@ asmlinkage int sys_pipe(unsigned long * fildes) int fd[2]; int error; - lock_kernel(); error = do_pipe(fd); if (!error) { if (copy_to_user(fildes, fd, 2*sizeof(int))) error = -EFAULT; } - unlock_kernel(); return error; } @@ -61,11 +59,7 @@ static inline long do_mmap2( } down(¤t->mm->mmap_sem); - lock_kernel(); - error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); - - unlock_kernel(); up(¤t->mm->mmap_sem); if (file) @@ -143,7 +137,6 @@ asmlinkage long sys_mmap64(struct mmap_arg_struct64 *arg) if ((a.offset >> PAGE_SHIFT) != pgoff) return -EINVAL; - lock_kernel(); if (!(a.flags & MAP_ANONYMOUS)) { error = -EBADF; file = fget(a.fd); @@ -158,7 +151,6 @@ asmlinkage long sys_mmap64(struct mmap_arg_struct64 *arg) if (file) fput(file); out: - unlock_kernel(); return error; } #endif diff --git a/arch/mips/baget/vacserial.c b/arch/mips/baget/vacserial.c index 048e32ed5..4994d013e 100644 --- a/arch/mips/baget/vacserial.c +++ b/arch/mips/baget/vacserial.c @@ -115,6 +115,9 @@ static struct console sercons; static void autoconfig(struct serial_state * info); static void change_speed(struct async_struct *info); static void rs_wait_until_sent(struct tty_struct *tty, int timeout); +static void rs_timer(unsigned long dummy); + +static struct timer_list vacs_timer; /* * Here we define the default xmit fifo size used for each type of @@ -750,8 +753,7 @@ static int startup(struct async_struct * info) /* * Set up serial timers... */ - timer_table[RS_TIMER].expires = jiffies + 2*HZ/100; - timer_active |= 1 << RS_TIMER; + mod_timer(&vacs_timer, jiffies + 2*HZ/100); /* * and set the speed of the serial port @@ -2255,7 +2257,7 @@ EXPORT_SYMBOL(unregister_serial); * Important function for VAC UART check and reanimation. */ -static void rs_timer(void) +static void rs_timer(unsigned long dummy) { static unsigned long last_strobe = 0; struct async_struct *info; @@ -2285,8 +2287,7 @@ static void rs_timer(void) } } last_strobe = jiffies; - timer_table[RS_TIMER].expires = jiffies + RS_STROBE_TIME; - timer_active |= 1 << RS_TIMER; + mod_timer(&vacs_timer, jiffies + RS_STROBE_TIME); /* * It looks this code for case we share IRQ with console... @@ -2301,7 +2302,7 @@ static void rs_timer(void) #endif restore_flags(flags); - timer_table[RS_TIMER].expires = jiffies + IRQ_timeout[0] - 2; + mod_timer(&vacs_timer, jiffies + IRQ_timeout[0] - 2); } } @@ -2323,8 +2324,9 @@ int __init rs_init(void) #endif init_bh(SERIAL_BH, do_serial_bh); - timer_table[RS_TIMER].fn = rs_timer; - timer_table[RS_TIMER].expires = 0; + init_timer(&vacs_timer); + vacs_timer.function = rs_timer; + vacs_timer.expires = 0; for (i = 0; i < NR_IRQS; i++) { IRQ_ports[i] = 0; @@ -2528,9 +2530,7 @@ void cleanup_module(void) save_flags(flags); cli(); - timer_active &= ~(1 << RS_TIMER); - timer_table[RS_TIMER].fn = NULL; - timer_table[RS_TIMER].expires = 0; + del_timer_sync(&vacs_timer); remove_bh(SERIAL_BH); if ((e1 = tty_unregister_driver(&serial_driver))) diff --git a/arch/mips/config.in b/arch/mips/config.in index cd419753f..4cf16f8d1 100644 --- a/arch/mips/config.in +++ b/arch/mips/config.in @@ -182,6 +182,8 @@ else define_bool CONFIG_PCMCIA n fi +source drivers/mtd/Config.in + source drivers/block/Config.in if [ "$CONFIG_NET" = "y" ]; then diff --git a/arch/mips/defconfig b/arch/mips/defconfig index 319e82093..18c31669d 100644 --- a/arch/mips/defconfig +++ b/arch/mips/defconfig @@ -68,6 +68,11 @@ CONFIG_KMOD=y # CONFIG_PCMCIA is not set # +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# # Block devices # # CONFIG_BLK_DEV_FD is not set @@ -232,6 +237,7 @@ CONFIG_AUTOFS4_FS=y # CONFIG_UMSDOS_FS is not set # CONFIG_VFAT_FS is not set # CONFIG_EFS_FS is not set +# CONFIG_JFFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set CONFIG_ISO9660_FS=y diff --git a/arch/mips/defconfig-cobalt b/arch/mips/defconfig-cobalt index ff90a0115..e2700ed7a 100644 --- a/arch/mips/defconfig-cobalt +++ b/arch/mips/defconfig-cobalt @@ -69,6 +69,11 @@ CONFIG_KMOD=y # CONFIG_PCMCIA is not set # +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# # Block devices # # CONFIG_BLK_DEV_FD is not set @@ -461,6 +466,7 @@ CONFIG_MSDOS_FS=m # CONFIG_UMSDOS_FS is not set CONFIG_VFAT_FS=m # CONFIG_EFS_FS is not set +# CONFIG_JFFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set CONFIG_ISO9660_FS=m diff --git a/arch/mips/defconfig-decstation b/arch/mips/defconfig-decstation index add5390d8..c0e7558f1 100644 --- a/arch/mips/defconfig-decstation +++ b/arch/mips/defconfig-decstation @@ -64,6 +64,11 @@ CONFIG_TC=y # CONFIG_PCMCIA is not set # +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# # Block devices # # CONFIG_BLK_DEV_FD is not set @@ -228,6 +233,7 @@ CONFIG_SERIAL_CONSOLE=y # CONFIG_UMSDOS_FS is not set # CONFIG_VFAT_FS is not set # CONFIG_EFS_FS is not set +# CONFIG_JFFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set # CONFIG_ISO9660_FS is not set diff --git a/arch/mips/defconfig-ip22 b/arch/mips/defconfig-ip22 index 319e82093..18c31669d 100644 --- a/arch/mips/defconfig-ip22 +++ b/arch/mips/defconfig-ip22 @@ -68,6 +68,11 @@ CONFIG_KMOD=y # CONFIG_PCMCIA is not set # +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# # Block devices # # CONFIG_BLK_DEV_FD is not set @@ -232,6 +237,7 @@ CONFIG_AUTOFS4_FS=y # CONFIG_UMSDOS_FS is not set # CONFIG_VFAT_FS is not set # CONFIG_EFS_FS is not set +# CONFIG_JFFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set CONFIG_ISO9660_FS=y diff --git a/arch/mips/defconfig-rm200 b/arch/mips/defconfig-rm200 index 545d3ea6d..fba87cd6b 100644 --- a/arch/mips/defconfig-rm200 +++ b/arch/mips/defconfig-rm200 @@ -72,6 +72,11 @@ CONFIG_KMOD=y # CONFIG_PCMCIA is not set # +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# # Block devices # CONFIG_BLK_DEV_FD=y @@ -247,6 +252,7 @@ CONFIG_VT_CONSOLE=y # CONFIG_UMSDOS_FS is not set # CONFIG_VFAT_FS is not set # CONFIG_EFS_FS is not set +# CONFIG_JFFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set # CONFIG_ISO9660_FS is not set diff --git a/arch/mips/kernel/irixelf.c b/arch/mips/kernel/irixelf.c index 24a18824e..25f198f16 100644 --- a/arch/mips/kernel/irixelf.c +++ b/arch/mips/kernel/irixelf.c @@ -1284,7 +1284,7 @@ static int __init init_irix_binfmt(void) return register_binfmt(&irix_format); } -static void __exit cleanup_module(void) +static void __exit exit_irix_binfmt(void) { /* Remove the IRIX ELF loaders. */ unregister_binfmt(&irix_format); diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index d2df0dc20..d98507f16 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c @@ -42,7 +42,6 @@ asmlinkage int sys_pipe(struct pt_regs regs) int fd[2]; int error, res; - lock_kernel(); error = do_pipe(fd); if (error) { res = error; @@ -51,7 +50,6 @@ asmlinkage int sys_pipe(struct pt_regs regs) regs.regs[3] = fd[1]; res = fd[0]; out: - unlock_kernel(); return res; } @@ -71,11 +69,7 @@ do_mmap2(unsigned long addr, unsigned long len, unsigned long prot, } down(¤t->mm->mmap_sem); - lock_kernel(); - error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); - - unlock_kernel(); up(¤t->mm->mmap_sem); if (file) diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c index f8b7d37c9..817e9c1ee 100644 --- a/arch/mips/kernel/sysirix.c +++ b/arch/mips/kernel/sysirix.c @@ -1,12 +1,10 @@ -/* $Id: sysirix.c,v 1.26 2000/03/12 23:15:33 ralf Exp $ - * +/* * sysirix.c: IRIX system call emulation. * * Copyright (C) 1996 David S. Miller * Copyright (C) 1997 Miguel de Icaza * Copyright (C) 1997, 1998 Ralf Baechle */ - #include <linux/kernel.h> #include <linux/sched.h> #include <linux/pagemap.h> @@ -32,7 +30,7 @@ #include <asm/sgialib.h> #include <asm/inventory.h> -/* 2,526 lines of complete and utter shit coming up... */ +/* 2,191 lines of complete and utter shit coming up... */ extern int max_threads; @@ -91,11 +89,10 @@ asmlinkage int irix_prctl(struct pt_regs *regs) unsigned long cmd; int error = 0, base = 0; - lock_kernel(); - if(regs->regs[2] == 1000) + if (regs->regs[2] == 1000) base = 1; cmd = regs->regs[base + 4]; - switch(cmd) { + switch (cmd) { case PR_MAXPROCS: printk("irix_prctl[%s:%d]: Wants PR_MAXPROCS\n", current->comm, current->pid); @@ -107,12 +104,12 @@ asmlinkage int irix_prctl(struct pt_regs *regs) printk("irix_prctl[%s:%d]: Wants PR_ISBLOCKED\n", current->comm, current->pid); + read_lock(&tasklist_lock); task = find_task_by_pid(regs->regs[base + 5]); - if(!task) { - error = -ESRCH; - break; - } - error = (task->run_list.next != NULL); + error = -ESRCH; + if (error) + error = (task->run_list.next != NULL); + read_unlock(&tasklist_lock); /* Can _your_ OS find this out that fast? */ break; } @@ -122,15 +119,15 @@ asmlinkage int irix_prctl(struct pt_regs *regs) printk("irix_prctl[%s:%d]: Wants PR_SETSTACKSIZE<%08lx>\n", current->comm, current->pid, (unsigned long) value); - if(value > RLIM_INFINITY) + if (value > RLIM_INFINITY) value = RLIM_INFINITY; - if(capable(CAP_SYS_ADMIN)) { + if (capable(CAP_SYS_ADMIN)) { current->rlim[RLIMIT_STACK].rlim_max = current->rlim[RLIMIT_STACK].rlim_cur = value; error = value; break; } - if(value > current->rlim[RLIMIT_STACK].rlim_max) { + if (value > current->rlim[RLIMIT_STACK].rlim_max) { error = -EINVAL; break; } @@ -226,7 +223,6 @@ asmlinkage int irix_prctl(struct pt_regs *regs) break; } - unlock_kernel(); return error; } @@ -267,78 +263,80 @@ extern long prom_setenv(char *name, char *value); asmlinkage int irix_syssgi(struct pt_regs *regs) { - unsigned long cmd; - int retval, base = 0; + unsigned long cmd; + int retval, base = 0; - lock_kernel(); - if(regs->regs[2] == 1000) - base = 1; + if (regs->regs[2] == 1000) + base = 1; - cmd = regs->regs[base + 4]; - switch(cmd) { - case SGI_SYSID: { - char *buf = (char *) regs->regs[base + 5]; + cmd = regs->regs[base + 4]; + switch(cmd) { + case SGI_SYSID: { + char *buf = (char *) regs->regs[base + 5]; - /* XXX Use ethernet addr.... */ - retval = clear_user(buf, 64); - break; - } + /* XXX Use ethernet addr.... */ + retval = clear_user(buf, 64); + break; + } #if 0 - case SGI_RDNAME: { - int pid = (int) regs->regs[base + 5]; - char *buf = (char *) regs->regs[base + 6]; - struct task_struct *p; - - retval = verify_area(VERIFY_WRITE, buf, 16); - if(retval) - break; - for_each_task(p) { - if(p->pid == pid) - goto found0; - } - retval = -ESRCH; - - found0: - /* XXX Need to check sizes. */ - copy_to_user(buf, p->comm, 16); - retval = 0; - break; - } - - case SGI_GETNVRAM: { - char *name = (char *) regs->regs[base+5]; - char *buf = (char *) regs->regs[base+6]; - char *value; + case SGI_RDNAME: { + int pid = (int) regs->regs[base + 5]; + char *buf = (char *) regs->regs[base + 6]; + struct task_struct *p; + char comm[16]; + + retval = verify_area(VERIFY_WRITE, buf, 16); + if (retval) + break; + read_lock(&tasklist_lock); + p = find_task_by_pid(pid); + if (!p) { + read_unlock(&tasklist_lock); + retval = -ESRCH; + break; + } + memcpy(comm, p->comm, 16); + read_unlock(&tasklist_lock); + + /* XXX Need to check sizes. */ + copy_to_user(buf, p->comm, 16); + retval = 0; + break; + } + + case SGI_GETNVRAM: { + char *name = (char *) regs->regs[base+5]; + char *buf = (char *) regs->regs[base+6]; + char *value; return -EINVAL; /* til I fix it */ - retval = verify_area(VERIFY_WRITE, buf, 128); - if (retval) - break; - value = prom_getenv(name); - if (!value) { - retval = -EINVAL; - break; - } - /* Do I strlen() for the length? */ - copy_to_user(buf, value, 128); - retval = 0; - break; - } - - case SGI_SETNVRAM: { - char *name = (char *) regs->regs[base+5]; - char *value = (char *) regs->regs[base+6]; + retval = verify_area(VERIFY_WRITE, buf, 128); + if (retval) + break; + value = prom_getenv(name); /* PROM lock? */ + if (!value) { + retval = -EINVAL; + break; + } + /* Do I strlen() for the length? */ + copy_to_user(buf, value, 128); + retval = 0; + break; + } + + case SGI_SETNVRAM: { + char *name = (char *) regs->regs[base+5]; + char *value = (char *) regs->regs[base+6]; return -EINVAL; /* til I fix it */ - retval = prom_setenv(name, value); + retval = prom_setenv(name, value); /* XXX make sure retval conforms to syssgi(2) */ printk("[%s:%d] setnvram(\"%s\", \"%s\"): retval %d", - current->comm, current->pid, - name, value, retval); + current->comm, current->pid, name, value, retval); /* if (retval == PROM_ENOENT) retval = -ENOENT; */ break; } #endif - + case SGI_SETPGID: { #ifdef DEBUG_PROCGRPS printk("[%s:%d] setpgid(%d, %d) ", @@ -463,25 +461,31 @@ asmlinkage int irix_syssgi(struct pt_regs *regs) break; case SGI_PHYSP: { + unsigned long addr = regs->regs[base + 5]; + int *pageno = (int *) (regs->regs[base + 6]); + struct mm_struct *mm = current->mm; pgd_t *pgdp; pmd_t *pmdp; pte_t *ptep; - unsigned long addr = regs->regs[base + 5]; - int *pageno = (int *) (regs->regs[base + 6]); retval = verify_area(VERIFY_WRITE, pageno, sizeof(int)); - if(retval) + if (retval) return retval; - pgdp = pgd_offset(current->mm, addr); + + down(&mm->mmap_sem); + pgdp = pgd_offset(mm, addr); pmdp = pmd_offset(pgdp, addr); ptep = pte_offset(pmdp, addr); - if(ptep) { - if(pte_val(*ptep) & (_PAGE_VALID | _PAGE_PRESENT)) { - return put_user((pte_val(*ptep) & PAGE_MASK)>>PAGE_SHIFT, pageno); - return 0; + retval = -EINVAL; + if (ptep) { + pte_t pte = *ptep; + + if (pte_val(pte) & (_PAGE_VALID | _PAGE_PRESENT)) { + retval = put_user((pte_val(pte) & PAGE_MASK) >> + PAGE_SHIFT, pageno); } } - retval = -EINVAL; + up(&mm->mmap_sem); break; } @@ -490,7 +494,7 @@ asmlinkage int irix_syssgi(struct pt_regs *regs) void *buffer = (void *) regs->regs [base + 6]; int count = (int) regs->regs [base + 7]; - switch (arg1){ + switch (arg1) { case SGI_INV_SIZEOF: retval = sizeof (inventory_t); break; @@ -510,7 +514,6 @@ asmlinkage int irix_syssgi(struct pt_regs *regs) }; out: - unlock_kernel(); return retval; } @@ -532,7 +535,7 @@ asmlinkage int irix_brk(unsigned long brk) struct mm_struct *mm = current->mm; int ret; - lock_kernel(); + down(&mm->mmap_sem); if (brk < mm->end_code) { ret = -ENOMEM; goto out; @@ -590,7 +593,7 @@ asmlinkage int irix_brk(unsigned long brk) ret = 0; out: - unlock_kernel(); + up(&mm->mmap_sem); return ret; } @@ -612,26 +615,21 @@ asmlinkage int irix_getgid(struct pt_regs *regs) return current->gid; } +extern rwlock_t xtime_lock; + asmlinkage int irix_stime(int value) { - int ret; + if (!capable(CAP_SYS_TIME)) + return -EPERM; - lock_kernel(); - if(!capable(CAP_SYS_TIME)) { - ret = -EPERM; - goto out; - } - cli(); + write_lock_irq(&xtime_lock); xtime.tv_sec = value; xtime.tv_usec = 0; time_maxerror = MAXPHASE; time_esterror = MAXPHASE; - sti(); - ret = 0; + write_unlock_irq(&xtime_lock); -out: - unlock_kernel(); - return ret; + return 0; } extern int do_setitimer(int which, struct itimerval *value, @@ -641,7 +639,6 @@ static inline void jiffiestotv(unsigned long jiffies, struct timeval *value) { value->tv_usec = (jiffies % HZ) * (1000000 / HZ); value->tv_sec = jiffies / HZ; - return; } static inline void getitimer_real(struct itimerval *value) @@ -668,8 +665,7 @@ asmlinkage unsigned int irix_alarm(unsigned int seconds) struct itimerval it_new, it_old; unsigned int oldalarm; - lock_kernel(); - if(!seconds) { + if (!seconds) { getitimer_real(&it_old); del_timer(¤t->real_timer); } else { @@ -679,20 +675,21 @@ asmlinkage unsigned int irix_alarm(unsigned int seconds) do_setitimer(ITIMER_REAL, &it_new, &it_old); } oldalarm = it_old.it_value.tv_sec; - /* ehhh.. We can't return 0 if we have an alarm pending.. */ - /* And we'd better return too much than too little anyway */ + /* + * ehhh.. We can't return 0 if we have an alarm pending ... + * And we'd better return too much than too little anyway + */ if (it_old.it_value.tv_usec) oldalarm++; - unlock_kernel(); + return oldalarm; } asmlinkage int irix_pause(void) { - lock_kernel(); current->state = TASK_INTERRUPTIBLE; schedule(); - unlock_kernel(); + return -EINTR; } @@ -703,16 +700,11 @@ extern asmlinkage long sys_mount(char * dev_name, char * dir_name, char * type, asmlinkage int irix_mount(char *dev_name, char *dir_name, unsigned long flags, char *type, void *data, int datalen) { - int ret; - - lock_kernel(); printk("[%s:%d] irix_mount(%p,%p,%08lx,%p,%p,%d)\n", current->comm, current->pid, dev_name, dir_name, flags, type, data, datalen); - ret = sys_mount(dev_name, dir_name, type, flags, data); - unlock_kernel(); - return ret; + return sys_mount(dev_name, dir_name, type, flags, data); } struct irix_statfs { @@ -728,10 +720,8 @@ asmlinkage int irix_statfs(const char *path, struct irix_statfs *buf, struct statfs kbuf; int error, i; - lock_kernel(); - /* We don't support this feature yet. */ - if(fs_type) { + if (fs_type) { error = -EINVAL; goto out; } @@ -753,7 +743,7 @@ asmlinkage int irix_statfs(const char *path, struct irix_statfs *buf, __put_user(kbuf.f_bfree, &buf->f_bfree); __put_user(kbuf.f_files, &buf->f_files); __put_user(kbuf.f_ffree, &buf->f_ffree); - for(i = 0; i < 6; i++) { + for (i = 0; i < 6; i++) { __put_user(0, &buf->f_fname[i]); __put_user(0, &buf->f_fpack[i]); } @@ -762,7 +752,6 @@ asmlinkage int irix_statfs(const char *path, struct irix_statfs *buf, dput_and_out: path_release(&nd); out: - unlock_kernel(); return error; } @@ -772,7 +761,6 @@ asmlinkage int irix_fstatfs(unsigned int fd, struct irix_statfs *buf) struct file *file; int error, i; - lock_kernel(); error = verify_area(VERIFY_WRITE, buf, sizeof(struct irix_statfs)); if (error) goto out; @@ -800,7 +788,6 @@ asmlinkage int irix_fstatfs(unsigned int fd, struct irix_statfs *buf) out_f: fput(file); out: - unlock_kernel(); return error; } @@ -811,7 +798,6 @@ asmlinkage int irix_setpgrp(int flags) { int error; - lock_kernel(); #ifdef DEBUG_PROCGRPS printk("[%s:%d] setpgrp(%d) ", current->comm, current->pid, flags); #endif @@ -823,29 +809,24 @@ asmlinkage int irix_setpgrp(int flags) printk("returning %d\n", current->pgrp); #endif - unlock_kernel(); return error; } asmlinkage int irix_times(struct tms * tbuf) { - int error; + int err = 0; - lock_kernel(); if (tbuf) { - error = verify_area(VERIFY_WRITE,tbuf,sizeof *tbuf); - if (error) - goto out; - __put_user(current->times.tms_utime,&tbuf->tms_utime); - __put_user(current->times.tms_stime,&tbuf->tms_stime); - __put_user(current->times.tms_cutime,&tbuf->tms_cutime); - __put_user(current->times.tms_cstime,&tbuf->tms_cstime); + err = verify_area(VERIFY_WRITE,tbuf,sizeof *tbuf); + if (err) + return err; + err |= __put_user(current->times.tms_utime,&tbuf->tms_utime); + err |= __put_user(current->times.tms_stime,&tbuf->tms_stime); + err |= __put_user(current->times.tms_cutime,&tbuf->tms_cutime); + err |= __put_user(current->times.tms_cstime,&tbuf->tms_cstime); } - error = 0; -out: - unlock_kernel(); - return error; + return err; } asmlinkage int irix_exec(struct pt_regs *regs) @@ -858,12 +839,12 @@ asmlinkage int irix_exec(struct pt_regs *regs) filename = getname((char *) (long)regs->regs[base + 4]); error = PTR_ERR(filename); if (IS_ERR(filename)) - goto out; + return error; + error = do_execve(filename, (char **) (long)regs->regs[base + 5], (char **) 0, regs); putname(filename); -out: return error; } @@ -872,37 +853,32 @@ asmlinkage int irix_exece(struct pt_regs *regs) int error, base = 0; char *filename; - lock_kernel(); - if(regs->regs[2] == 1000) + if (regs->regs[2] == 1000) base = 1; filename = getname((char *) (long)regs->regs[base + 4]); error = PTR_ERR(filename); if (IS_ERR(filename)) - goto out; + return error; error = do_execve(filename, (char **) (long)regs->regs[base + 5], (char **) (long)regs->regs[base + 6], regs); putname(filename); -out: - unlock_kernel(); return error; } asmlinkage unsigned long irix_gethostid(void) { - lock_kernel(); printk("[%s:%d]: irix_gethostid() called...\n", current->comm, current->pid); - unlock_kernel(); + return -EINVAL; } asmlinkage unsigned long irix_sethostid(unsigned long val) { - lock_kernel(); printk("[%s:%d]: irix_sethostid(%08lx) called...\n", current->comm, current->pid, val); - unlock_kernel(); + return -EINVAL; } @@ -946,20 +922,18 @@ asmlinkage int irix_getdomainname(char *name, int len) { int error; - lock_kernel(); + error = verify_area(VERIFY_WRITE, name, len); + if (error) + return error; + + down_read(&uts_sem); if(len > (__NEW_UTS_LEN - 1)) len = __NEW_UTS_LEN - 1; - error = verify_area(VERIFY_WRITE, name, len); - if(error) - goto out; - if(copy_to_user(name, system_utsname.domainname, len)) { - error = -EFAULT; - goto out; - } error = 0; + if (copy_to_user(name, system_utsname.domainname, len)) + error = -EFAULT; + up_read(&uts_sem); -out: - unlock_kernel(); return error; } @@ -972,7 +946,7 @@ asmlinkage int irix_msgsys(int opcode, unsigned long arg0, unsigned long arg1, unsigned long arg2, unsigned long arg3, unsigned long arg4) { - switch(opcode) { + switch (opcode) { case 0: return sys_msgget((key_t) arg0, (int) arg1); case 1: @@ -991,7 +965,7 @@ asmlinkage int irix_msgsys(int opcode, unsigned long arg0, unsigned long arg1, asmlinkage int irix_shmsys(int opcode, unsigned long arg0, unsigned long arg1, unsigned long arg2, unsigned long arg3) { - switch(opcode) { + switch (opcode) { case 0: return sys_shmat((int) arg0, (char *)arg1, (int) arg2, (unsigned long *) arg3); @@ -1009,7 +983,7 @@ asmlinkage int irix_shmsys(int opcode, unsigned long arg0, unsigned long arg1, asmlinkage int irix_semsys(int opcode, unsigned long arg0, unsigned long arg1, unsigned long arg2, int arg3) { - switch(opcode) { + switch (opcode) { case 0: return sys_semctl((int) arg0, (int) arg1, (int) arg2, (union semun) arg3); @@ -1023,27 +997,42 @@ asmlinkage int irix_semsys(int opcode, unsigned long arg0, unsigned long arg1, } } -extern asmlinkage int sys_llseek(unsigned int fd, unsigned long offset_high, - unsigned long offset_low, loff_t * result, - unsigned int origin); - -asmlinkage int irix_lseek64(int fd, int _unused, int offhi, int offlow, int base) +static inline loff_t llseek(struct file *file, loff_t offset, int origin) { - mm_segment_t old_fs; - loff_t junk; - int error; + loff_t (*fn)(struct file *, loff_t, int); + loff_t retval; + fn = default_llseek; + if (file->f_op && file->f_op->llseek) + fn = file->f_op->llseek; lock_kernel(); - old_fs = get_fs(); set_fs(get_ds()); - error = sys_llseek(fd, offhi, offlow, &junk, base); - set_fs(old_fs); - - if(error) - goto out; - error = (int) junk; -out: + retval = fn(file, offset, origin); unlock_kernel(); - return error; + return retval; +} + +asmlinkage int irix_lseek64(int fd, int _unused, int offhi, int offlow, + int origin) +{ + int retval; + struct file * file; + loff_t offset; + + retval = -EBADF; + file = fget(fd); + if (!file) + goto bad; + retval = -EINVAL; + if (origin > 2) + goto out_putf; + + offset = llseek(file, ((loff_t) offhi << 32) | offlow, origin); + retval = (int) offset; + +out_putf: + fput(file); +bad: + return retval; } asmlinkage int irix_sginap(int ticks) @@ -1062,9 +1051,7 @@ asmlinkage int irix_gettimeofday(struct timeval *tv) { int retval; - lock_kernel(); retval = copy_to_user(tv, &xtime, sizeof(*tv)) ? -EFAULT : 0; - unlock_kernel(); return retval; } @@ -1076,12 +1063,9 @@ asmlinkage unsigned long irix_mmap32(unsigned long addr, size_t len, int prot, struct file *file = NULL; unsigned long retval; - lock_kernel(); if (!(flags & MAP_ANONYMOUS)) { - if (!(file = fget(fd))) { - retval = -EBADF; - goto out; - } + if (!(file = fget(fd))) + return -EBADF; /* Ok, bad taste hack follows, try to think in something else * when reading this. */ @@ -1105,36 +1089,30 @@ asmlinkage unsigned long irix_mmap32(unsigned long addr, size_t len, int prot, if (file) fput(file); -out: - unlock_kernel(); - return retval; } asmlinkage int irix_madvise(unsigned long addr, int len, int behavior) { - lock_kernel(); printk("[%s:%d] Wheee.. irix_madvise(%08lx,%d,%d)\n", current->comm, current->pid, addr, len, behavior); - unlock_kernel(); + return -EINVAL; } asmlinkage int irix_pagelock(char *addr, int len, int op) { - lock_kernel(); printk("[%s:%d] Wheee.. irix_pagelock(%p,%d,%d)\n", current->comm, current->pid, addr, len, op); - unlock_kernel(); + return -EINVAL; } asmlinkage int irix_quotactl(struct pt_regs *regs) { - lock_kernel(); printk("[%s:%d] Wheee.. irix_quotactl()\n", current->comm, current->pid); - unlock_kernel(); + return -EINVAL; } @@ -1142,7 +1120,6 @@ asmlinkage int irix_BSDsetpgrp(int pid, int pgrp) { int error; - lock_kernel(); #ifdef DEBUG_PROCGRPS printk("[%s:%d] BSDsetpgrp(%d, %d) ", current->comm, current->pid, pid, pgrp); @@ -1151,7 +1128,7 @@ asmlinkage int irix_BSDsetpgrp(int pid, int pgrp) pid = current->pid; /* Wheee, weird sysv thing... */ - if((pgrp == 0) && (pid == current->pid)) + if ((pgrp == 0) && (pid == current->pid)) error = sys_setsid(); else error = sys_setpgid(pid, pgrp); @@ -1160,16 +1137,14 @@ asmlinkage int irix_BSDsetpgrp(int pid, int pgrp) printk("error = %d\n", error); #endif - unlock_kernel(); return error; } asmlinkage int irix_systeminfo(int cmd, char *buf, int cnt) { - lock_kernel(); printk("[%s:%d] Wheee.. irix_systeminfo(%d,%p,%d)\n", current->comm, current->pid, cmd, buf, cnt); - unlock_kernel(); + return -EINVAL; } @@ -1183,22 +1158,17 @@ struct iuname { asmlinkage int irix_uname(struct iuname *buf) { - int retval; - - lock_kernel(); - if(copy_to_user(system_utsname.sysname, buf->sysname, 65) - || copy_to_user(system_utsname.nodename, buf->nodename, 65) - || copy_to_user(system_utsname.release, buf->release, 65) - || copy_to_user(system_utsname.version, buf->version, 65) - || copy_to_user(system_utsname.machine, buf->machine, 65)) { - retval = -EFAULT; - goto out; + down_read(&uts_sem); + if (copy_to_user(system_utsname.sysname, buf->sysname, 65) + || copy_to_user(system_utsname.nodename, buf->nodename, 65) + || copy_to_user(system_utsname.release, buf->release, 65) + || copy_to_user(system_utsname.version, buf->version, 65) + || copy_to_user(system_utsname.machine, buf->machine, 65)) { + return -EFAULT; } - retval = 1; + up_read(&uts_sem); -out: - unlock_kernel(); - return retval; + return 1; } #undef DEBUG_XSTAT @@ -1293,7 +1263,6 @@ asmlinkage int irix_xstat(int version, char *filename, struct stat *statbuf) { int retval; - lock_kernel(); #ifdef DEBUG_XSTAT printk("[%s:%d] Wheee.. irix_xstat(%d,%s,%p) ", current->comm, current->pid, version, filename, statbuf); @@ -1334,7 +1303,6 @@ asmlinkage int irix_xstat(int version, char *filename, struct stat *statbuf) } out: - unlock_kernel(); return retval; } @@ -1344,7 +1312,6 @@ asmlinkage int irix_lxstat(int version, char *filename, struct stat *statbuf) { int error; - lock_kernel(); #ifdef DEBUG_XSTAT printk("[%s:%d] Wheee.. irix_lxstat(%d,%s,%p) ", current->comm, current->pid, version, filename, statbuf); @@ -1385,7 +1352,6 @@ asmlinkage int irix_lxstat(int version, char *filename, struct stat *statbuf) } out: - unlock_kernel(); return error; } @@ -1395,7 +1361,6 @@ asmlinkage int irix_fxstat(int version, int fd, struct stat *statbuf) { int error; - lock_kernel(); #ifdef DEBUG_XSTAT printk("[%s:%d] Wheee.. irix_fxstat(%d,%d,%p) ", current->comm, current->pid, version, fd, statbuf); @@ -1436,7 +1401,6 @@ asmlinkage int irix_fxstat(int version, int fd, struct stat *statbuf) } out: - unlock_kernel(); return error; } @@ -1446,30 +1410,27 @@ asmlinkage int irix_xmknod(int ver, char *filename, int mode, dev_t dev) { int retval; - lock_kernel(); printk("[%s:%d] Wheee.. irix_xmknod(%d,%s,%x,%x)\n", current->comm, current->pid, ver, filename, mode, (int) dev); + switch(ver) { case 2: retval = sys_mknod(filename, mode, dev); - goto out; + break; default: retval = -EINVAL; - goto out; + break; }; -out: - unlock_kernel(); return retval; } asmlinkage int irix_swapctl(int cmd, char *arg) { - lock_kernel(); printk("[%s:%d] Wheee.. irix_swapctl(%d,%p)\n", current->comm, current->pid, cmd, arg); - unlock_kernel(); + return -EINVAL; } @@ -1487,7 +1448,6 @@ asmlinkage int irix_statvfs(char *fname, struct irix_statvfs *buf) struct statfs kbuf; int error, i; - lock_kernel(); printk("[%s:%d] Wheee.. irix_statvfs(%s,%p)\n", current->comm, current->pid, fname, buf); error = verify_area(VERIFY_WRITE, buf, sizeof(struct irix_statvfs)); @@ -1513,11 +1473,11 @@ asmlinkage int irix_statvfs(char *fname, struct irix_statvfs *buf) #else __put_user(kbuf.f_fsid.val[0], &buf->f_fsid); #endif - for(i = 0; i < 16; i++) + for (i = 0; i < 16; i++) __put_user(0, &buf->f_basetype[i]); __put_user(0, &buf->f_flag); __put_user(kbuf.f_namelen, &buf->f_namemax); - for(i = 0; i < 32; i++) + for (i = 0; i < 32; i++) __put_user(0, &buf->f_fstr[i]); error = 0; @@ -1525,7 +1485,6 @@ asmlinkage int irix_statvfs(char *fname, struct irix_statvfs *buf) dput_and_out: path_release(&nd); out: - unlock_kernel(); return error; } @@ -1535,7 +1494,6 @@ asmlinkage int irix_fstatvfs(int fd, struct irix_statvfs *buf) struct file *file; int error, i; - lock_kernel(); printk("[%s:%d] Wheee.. irix_fstatvfs(%d,%p)\n", current->comm, current->pid, fd, buf); @@ -1572,25 +1530,22 @@ asmlinkage int irix_fstatvfs(int fd, struct irix_statvfs *buf) out_f: fput(file); out: - unlock_kernel(); return error; } asmlinkage int irix_priocntl(struct pt_regs *regs) { - lock_kernel(); printk("[%s:%d] Wheee.. irix_priocntl()\n", current->comm, current->pid); - unlock_kernel(); + return -EINVAL; } asmlinkage int irix_sigqueue(int pid, int sig, int code, int val) { - lock_kernel(); printk("[%s:%d] Wheee.. irix_sigqueue(%d,%d,%d,%d)\n", current->comm, current->pid, pid, sig, code, val); - unlock_kernel(); + return -EINVAL; } @@ -1601,15 +1556,13 @@ asmlinkage int irix_truncate64(char *name, int pad, int size1, int size2) { int retval; - lock_kernel(); - if(size1) { + if (size1) { retval = -EINVAL; goto out; } retval = sys_truncate(name, size2); out: - unlock_kernel(); return retval; } @@ -1617,15 +1570,13 @@ asmlinkage int irix_ftruncate64(int fd, int pad, int size1, int size2) { int retval; - lock_kernel(); - if(size1) { + if (size1) { retval = -EINVAL; goto out; } retval = sys_ftruncate(fd, size2); out: - unlock_kernel(); return retval; } @@ -1639,7 +1590,6 @@ asmlinkage int irix_mmap64(struct pt_regs *regs) unsigned long addr, pgoff, *sp; struct file *file = NULL; - lock_kernel(); if (regs->regs[2] == 1000) base = 1; sp = (unsigned long *) (regs->regs[29] + 16); @@ -1701,8 +1651,6 @@ asmlinkage int irix_mmap64(struct pt_regs *regs) fput(file); out: - unlock_kernel(); - return error; } @@ -1761,7 +1709,6 @@ asmlinkage int irix_statvfs64(char *fname, struct irix_statvfs64 *buf) struct statfs kbuf; int error, i; - lock_kernel(); printk("[%s:%d] Wheee.. irix_statvfs(%s,%p)\n", current->comm, current->pid, fname, buf); error = verify_area(VERIFY_WRITE, buf, sizeof(struct irix_statvfs)); @@ -1799,7 +1746,6 @@ asmlinkage int irix_statvfs64(char *fname, struct irix_statvfs64 *buf) dput_and_out: path_release(&nd); out: - unlock_kernel(); return error; } @@ -1809,7 +1755,6 @@ asmlinkage int irix_fstatvfs64(int fd, struct irix_statvfs *buf) struct file *file; int error, i; - lock_kernel(); printk("[%s:%d] Wheee.. irix_fstatvfs(%d,%p)\n", current->comm, current->pid, fd, buf); @@ -1846,20 +1791,18 @@ asmlinkage int irix_fstatvfs64(int fd, struct irix_statvfs *buf) out_f: fput(file); out: - unlock_kernel(); return error; } asmlinkage int irix_getmountid(char *fname, unsigned long *midbuf) { - int error; + int err; - lock_kernel(); printk("[%s:%d] irix_getmountid(%s, %p)\n", current->comm, current->pid, fname, midbuf); - error = verify_area(VERIFY_WRITE, midbuf, (sizeof(unsigned long) * 4)); - if(error) - goto out; + err = verify_area(VERIFY_WRITE, midbuf, (sizeof(unsigned long) * 4)); + if (err) + return err; /* * The idea with this system call is that when trying to determine @@ -1867,24 +1810,20 @@ asmlinkage int irix_getmountid(char *fname, unsigned long *midbuf) * fsid of the filesystem to try and make the right decision, but * we don't have this so for now. XXX */ - __put_user(0, &midbuf[0]); - __put_user(0, &midbuf[1]); - __put_user(0, &midbuf[2]); - __put_user(0, &midbuf[3]); - error = 0; + err |= __put_user(0, &midbuf[0]); + err |= __put_user(0, &midbuf[1]); + err |= __put_user(0, &midbuf[2]); + err |= __put_user(0, &midbuf[3]); -out: - unlock_kernel(); - return error; + return err; } asmlinkage int irix_nsproc(unsigned long entry, unsigned long mask, unsigned long arg, unsigned long sp, int slen) { - lock_kernel(); printk("[%s:%d] Wheee.. irix_nsproc(%08lx,%08lx,%08lx,%08lx,%d)\n", current->comm, current->pid, entry, mask, arg, sp, slen); - unlock_kernel(); + return -EINVAL; } @@ -1954,8 +1893,6 @@ asmlinkage int irix_ngetdents(unsigned int fd, void * dirent, unsigned int count if (!file) goto out; - lock_kernel(); - buf.current_dir = (struct irix_dirent32 *) dirent; buf.previous = NULL; buf.count = count; @@ -1983,7 +1920,6 @@ asmlinkage int irix_ngetdents(unsigned int fd, void * dirent, unsigned int count error = count - buf.count; out_putf: - unlock_kernel(); fput(file); out: return error; @@ -2048,14 +1984,12 @@ asmlinkage int irix_getdents64(int fd, void *dirent, int cnt) if (!(file = fget(fd))) goto out; - lock_kernel(); - error = -EFAULT; - if(!access_ok(VERIFY_WRITE, dirent, cnt)) + if (!access_ok(VERIFY_WRITE, dirent, cnt)) goto out_f; error = -EINVAL; - if(cnt < (sizeof(struct irix_dirent64) + 255)) + if (cnt < (sizeof(struct irix_dirent64) + 255)) goto out_f; buf.curr = (struct irix_dirent64 *) dirent; @@ -2077,7 +2011,6 @@ asmlinkage int irix_getdents64(int fd, void *dirent, int cnt) error = cnt - buf.count; out_f: - unlock_kernel(); fput(file); out: return error; @@ -2098,15 +2031,13 @@ asmlinkage int irix_ngetdents64(int fd, void *dirent, int cnt, int *eob) if (!(file = fget(fd))) goto out; - lock_kernel(); - error = -EFAULT; - if(!access_ok(VERIFY_WRITE, dirent, cnt) || - !access_ok(VERIFY_WRITE, eob, sizeof(*eob))) + if (!access_ok(VERIFY_WRITE, dirent, cnt) || + !access_ok(VERIFY_WRITE, eob, sizeof(*eob))) goto out_f; error = -EINVAL; - if(cnt < (sizeof(struct irix_dirent64) + 255)) + if (cnt < (sizeof(struct irix_dirent64) + 255)) goto out_f; *eob = 0; @@ -2129,7 +2060,6 @@ asmlinkage int irix_ngetdents64(int fd, void *dirent, int cnt, int *eob) error = cnt - buf.count; out_f: - unlock_kernel(); fput(file); out: return error; @@ -2139,8 +2069,7 @@ asmlinkage int irix_uadmin(unsigned long op, unsigned long func, unsigned long a { int retval; - lock_kernel(); - switch(op) { + switch (op) { case 1: /* Reboot */ printk("[%s:%d] irix_uadmin: Wants to reboot...\n", @@ -2184,7 +2113,6 @@ asmlinkage int irix_uadmin(unsigned long op, unsigned long func, unsigned long a }; out: - unlock_kernel(); return retval; } @@ -2192,7 +2120,6 @@ asmlinkage int irix_utssys(char *inbuf, int arg, int type, char *outbuf) { int retval; - lock_kernel(); switch(type) { case 0: /* uname() */ @@ -2221,7 +2148,6 @@ asmlinkage int irix_utssys(char *inbuf, int arg, int type, char *outbuf) } out: - unlock_kernel(); return retval; } @@ -2236,7 +2162,6 @@ asmlinkage int irix_fcntl(int fd, int cmd, int arg) { int retval; - lock_kernel(); #ifdef DEBUG_FCNTL printk("[%s:%d] irix_fcntl(%d, %d, %d) ", current->comm, current->pid, fd, cmd, arg); @@ -2248,7 +2173,6 @@ asmlinkage int irix_fcntl(int fd, int cmd, int arg) #ifdef DEBUG_FCNTL printk("%d\n", retval); #endif - unlock_kernel(); return retval; } @@ -2256,7 +2180,6 @@ asmlinkage int irix_ulimit(int cmd, int arg) { int retval; - lock_kernel(); switch(cmd) { case 1: printk("[%s:%d] irix_ulimit: Wants to get file size limit.\n", @@ -2299,7 +2222,6 @@ asmlinkage int irix_ulimit(int cmd, int arg) goto out; } out: - unlock_kernel(); return retval; } diff --git a/arch/mips64/config.in b/arch/mips64/config.in index 083969249..70e375fed 100644 --- a/arch/mips64/config.in +++ b/arch/mips64/config.in @@ -125,6 +125,8 @@ fi endmenu +source drivers/mtd/Config.in + source drivers/block/Config.in if [ "$CONFIG_NET" = "y" ]; then diff --git a/arch/mips64/defconfig b/arch/mips64/defconfig index 902f100eb..ba39829fa 100644 --- a/arch/mips64/defconfig +++ b/arch/mips64/defconfig @@ -61,6 +61,11 @@ CONFIG_BINFMT_ELF32=y CONFIG_PCI_NAMES=y # +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# # Block devices # # CONFIG_BLK_DEV_FD is not set @@ -344,6 +349,7 @@ CONFIG_SERIAL_CONSOLE=y # CONFIG_UMSDOS_FS is not set # CONFIG_VFAT_FS is not set # CONFIG_EFS_FS is not set +# CONFIG_JFFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set # CONFIG_ISO9660_FS is not set diff --git a/arch/mips64/defconfig-ip22 b/arch/mips64/defconfig-ip22 index daa8accb0..ef422eb5b 100644 --- a/arch/mips64/defconfig-ip22 +++ b/arch/mips64/defconfig-ip22 @@ -51,6 +51,11 @@ CONFIG_BINFMT_ELF=y # CONFIG_MODULES is not set # +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# # Block devices # # CONFIG_BLK_DEV_FD is not set @@ -263,6 +268,7 @@ CONFIG_VT_CONSOLE=y # CONFIG_UMSDOS_FS is not set # CONFIG_VFAT_FS is not set # CONFIG_EFS_FS is not set +# CONFIG_JFFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set # CONFIG_ISO9660_FS is not set diff --git a/arch/mips64/defconfig-ip27 b/arch/mips64/defconfig-ip27 index 902f100eb..ba39829fa 100644 --- a/arch/mips64/defconfig-ip27 +++ b/arch/mips64/defconfig-ip27 @@ -61,6 +61,11 @@ CONFIG_BINFMT_ELF32=y CONFIG_PCI_NAMES=y # +# Memory Technology Devices (MTD) +# +# CONFIG_MTD is not set + +# # Block devices # # CONFIG_BLK_DEV_FD is not set @@ -344,6 +349,7 @@ CONFIG_SERIAL_CONSOLE=y # CONFIG_UMSDOS_FS is not set # CONFIG_VFAT_FS is not set # CONFIG_EFS_FS is not set +# CONFIG_JFFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_RAMFS is not set # CONFIG_ISO9660_FS is not set diff --git a/arch/mips64/kernel/head.S b/arch/mips64/kernel/head.S index f87366d21..c7c474479 100644 --- a/arch/mips64/kernel/head.S +++ b/arch/mips64/kernel/head.S @@ -154,6 +154,7 @@ NESTED(bootstrap, 16, sp) .comm kernelsp, 8, 8 # current stackpointer +#undef PAGE_SIZE #define PAGE_SIZE 0x1000 .macro page name, order=0 diff --git a/arch/mips64/kernel/linux32.c b/arch/mips64/kernel/linux32.c index 28b3be98a..dfdc82d24 100644 --- a/arch/mips64/kernel/linux32.c +++ b/arch/mips64/kernel/linux32.c @@ -26,79 +26,6 @@ #define A(__x) ((unsigned long)(__x)) -#if 1 -static inline int -putstat(struct stat32 *ubuf, struct stat *kbuf) -{ - int err; - - err = put_user (kbuf->st_dev, &ubuf->st_dev); - err |= __put_user (kbuf->st_ino, &ubuf->st_ino); - err |= __put_user (kbuf->st_mode, &ubuf->st_mode); - err |= __put_user (kbuf->st_nlink, &ubuf->st_nlink); - err |= __put_user (kbuf->st_uid, &ubuf->st_uid); - err |= __put_user (kbuf->st_gid, &ubuf->st_gid); - err |= __put_user (kbuf->st_rdev, &ubuf->st_rdev); - err |= __put_user (kbuf->st_size, &ubuf->st_size); - err |= __put_user (kbuf->st_atime, &ubuf->st_atime); - err |= __put_user (kbuf->st_mtime, &ubuf->st_mtime); - err |= __put_user (kbuf->st_ctime, &ubuf->st_ctime); - err |= __put_user (kbuf->st_blksize, &ubuf->st_blksize); - err |= __put_user (kbuf->st_blocks, &ubuf->st_blocks); - return err; -} - -extern asmlinkage long sys_newstat(char * filename, struct stat * statbuf); - -asmlinkage int -sys32_newstat(char * filename, struct stat32 *statbuf) -{ - int ret; - struct stat s; - mm_segment_t old_fs = get_fs(); - - set_fs (KERNEL_DS); - ret = sys_newstat(filename, &s); - set_fs (old_fs); - if (putstat (statbuf, &s)) - return -EFAULT; - return ret; -} - -extern asmlinkage long sys_newlstat(char * filename, struct stat * statbuf); - -asmlinkage int -sys32_newlstat(char * filename, struct stat32 *statbuf) -{ - int ret; - struct stat s; - mm_segment_t old_fs = get_fs(); - - set_fs (KERNEL_DS); - ret = sys_newlstat(filename, &s); - set_fs (old_fs); - if (putstat (statbuf, &s)) - return -EFAULT; - return ret; -} - -extern asmlinkage long sys_newfstat(unsigned int fd, struct stat * statbuf); - -asmlinkage int -sys32_newfstat(unsigned int fd, struct stat32 *statbuf) -{ - int ret; - struct stat s; - mm_segment_t old_fs = get_fs(); - - set_fs (KERNEL_DS); - ret = sys_newfstat(fd, &s); - set_fs (old_fs); - if (putstat (statbuf, &s)) - return -EFAULT; - return ret; -} -#else /* * Revalidate the inode. This is required for proper NFS attribute caching. */ @@ -106,8 +33,10 @@ static __inline__ int do_revalidate(struct dentry *dentry) { struct inode * inode = dentry->d_inode; + if (inode->i_op && inode->i_op->revalidate) return inode->i_op->revalidate(dentry); + return 0; } @@ -128,21 +57,22 @@ static int cp_new_stat32(struct inode * inode, struct stat32 * statbuf) tmp.st_atime = inode->i_atime; tmp.st_mtime = inode->i_mtime; tmp.st_ctime = inode->i_ctime; -/* - * st_blocks and st_blksize are approximated with a simple algorithm if - * they aren't supported directly by the filesystem. The minix and msdos - * filesystems don't keep track of blocks, so they would either have to - * be counted explicitly (by delving into the file itself), or by using - * this simple algorithm to get a reasonable (although not 100% accurate) - * value. - */ -/* - * Use minix fs values for the number of direct and indirect blocks. The - * count is now exact for the minix fs except that it counts zero blocks. - * Everything is in units of BLOCK_SIZE until the assignment to - * tmp.st_blksize. - */ + /* + * st_blocks and st_blksize are approximated with a simple algorithm if + * they aren't supported directly by the filesystem. The minix and msdos + * filesystems don't keep track of blocks, so they would either have to + * be counted explicitly (by delving into the file itself), or by using + * this simple algorithm to get a reasonable (although not 100% + * accurate) value. + */ + + /* + * Use minix fs values for the number of direct and indirect blocks. + * The count is now exact for the minix fs except that it counts zero + * blocks. Everything is in units of BLOCK_SIZE until the assignment + * to tmp.st_blksize. + */ #define D_B 7 #define I_B (BLOCK_SIZE / sizeof(unsigned short)) @@ -164,53 +94,49 @@ static int cp_new_stat32(struct inode * inode, struct stat32 * statbuf) tmp.st_blocks = inode->i_blocks; tmp.st_blksize = inode->i_blksize; } + return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; } + asmlinkage int sys32_newstat(char * filename, struct stat32 *statbuf) { - struct dentry * dentry; + struct nameidata nd; int error; - lock_kernel(); - dentry = namei(filename); - - error = PTR_ERR(dentry); - if (!IS_ERR(dentry)) { - error = do_revalidate(dentry); + error = user_path_walk(filename, &nd); + if (!error) { + error = do_revalidate(nd.dentry); if (!error) - error = cp_new_stat32(dentry->d_inode, statbuf); + error = cp_new_stat32(nd.dentry->d_inode, statbuf); - dput(dentry); + path_release(&nd); } - unlock_kernel(); + return error; } -asmlinkage int sys32_newlstat(char *filename, struct stat32 * statbuf) + +asmlinkage int sys32_newlstat(char * filename, struct stat32 *statbuf) { - struct dentry * dentry; + struct nameidata nd; int error; - lock_kernel(); - dentry = lnamei(filename); - - error = PTR_ERR(dentry); - if (!IS_ERR(dentry)) { - error = do_revalidate(dentry); + error = user_path_walk_link(filename, &nd); + if (!error) { + error = do_revalidate(nd.dentry); if (!error) - error = cp_new_stat32(dentry->d_inode, statbuf); + error = cp_new_stat32(nd.dentry->d_inode, statbuf); - dput(dentry); + path_release(&nd); } - unlock_kernel(); + return error; } -asmlinkage int sys32_newfstat(unsigned int fd, struct stat32 * statbuf) +asmlinkage long sys32_newfstat(unsigned int fd, struct stat32 * statbuf) { struct file * f; int err = -EBADF; - lock_kernel(); f = fget(fd); if (f) { struct dentry * dentry = f->f_dentry; @@ -220,10 +146,10 @@ asmlinkage int sys32_newfstat(unsigned int fd, struct stat32 * statbuf) err = cp_new_stat32(dentry->d_inode, statbuf); fput(f); } - unlock_kernel(); + return err; } -#endif + asmlinkage int sys_mmap2(void) {return 0;} asmlinkage long sys_truncate(const char * path, unsigned long length); @@ -284,7 +210,8 @@ int copy_strings32(int argc, u32 * argv, struct linux_binprm *bprm) int len; unsigned long pos; - if (get_user(str, argv+argc) || !str || !(len = strnlen_user((char *)A(str), bprm->p))) + if (get_user(str, argv+argc) || !str || + !(len = strnlen_user((char *)A(str), bprm->p))) return -EFAULT; if (bprm->p < len) return -E2BIG; @@ -318,9 +245,11 @@ int copy_strings32(int argc, u32 * argv, struct linux_binprm *bprm) if (bytes_to_copy > len) { bytes_to_copy = len; if (new) - memset(kaddr+offset+len, 0, PAGE_SIZE-offset-len); + memset(kaddr+offset+len, 0, + PAGE_SIZE-offset-len); } - err = copy_from_user(kaddr + offset, (char *)A(str), bytes_to_copy); + err = copy_from_user(kaddr + offset, (char *)A(str), + bytes_to_copy); flush_page_to_ram(page); kunmap(page); @@ -469,12 +398,8 @@ sys32_execve(abi64_no_regargs, struct pt_regs regs) * `munmap' if the `execve' failes. */ down(¤t->mm->mmap_sem); - lock_kernel(); - av = (char **) do_mmap_pgoff(0, 0, len, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0); - - unlock_kernel(); up(¤t->mm->mmap_sem); if (IS_ERR(av)) @@ -954,7 +879,7 @@ do_readv_writev32(int type, struct file *file, const struct iovec32 *vector, tot_len = 0; i = count; ivp = iov; - while(i > 0) { + while (i > 0) { u32 len; u32 buf; @@ -1022,6 +947,7 @@ do_readv_writev32(int type, struct file *file, const struct iovec32 *vector, } if (iov != iovstack) kfree(iov); + return retval; } @@ -1029,22 +955,19 @@ asmlinkage long sys32_readv(int fd, struct iovec32 *vector, u32 count) { struct file *file; - long ret = -EBADF; + ssize_t ret; - lock_kernel(); + file = -EBADF; file = fget(fd); - if(!file) + if (!file) goto bad_file; + if (file->f_op && (file->f_mode & FMODE_READ) && + (file->f_op->readv || file->f_op->read)) + ret = do_readv_writev32(VERIFY_WRITE, file, vector, count); - if(!(file->f_mode & 1)) - goto out; - - ret = do_readv_writev32(VERIFY_WRITE, file, - vector, count); -out: fput(file); + bad_file: - unlock_kernel(); return ret; } @@ -1052,22 +975,18 @@ asmlinkage long sys32_writev(int fd, struct iovec32 *vector, u32 count) { struct file *file; - int ret = -EBADF; + ssize_t ret; - lock_kernel(); + ret = -EBADF; file = fget(fd); if(!file) goto bad_file; - - if(!(file->f_mode & 2)) - goto out; - - ret = do_readv_writev32(VERIFY_READ, file, - vector, count); -out: + if (file->f_op && (file->f_mode & FMODE_WRITE) && + (file->f_op->writev || file->f_op->write)) + ret = do_readv_writev32(VERIFY_READ, file, vector, count); fput(file); + bad_file: - unlock_kernel(); return ret; } @@ -1418,4 +1337,3 @@ asmlinkage long sys32_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg return sys_fcntl(fd, cmd, (unsigned long)arg); } } - diff --git a/arch/mips64/kernel/syscall.c b/arch/mips64/kernel/syscall.c index 8f90aad88..10559378a 100644 --- a/arch/mips64/kernel/syscall.c +++ b/arch/mips64/kernel/syscall.c @@ -36,7 +36,6 @@ asmlinkage int sys_pipe(abi64_no_regargs, struct pt_regs regs) int fd[2]; int error, res; - lock_kernel(); error = do_pipe(fd); if (error) { res = error; @@ -45,7 +44,6 @@ asmlinkage int sys_pipe(abi64_no_regargs, struct pt_regs regs) regs.regs[3] = fd[1]; res = fd[0]; out: - unlock_kernel(); return res; } @@ -56,7 +54,6 @@ sys_mmap(unsigned long addr, size_t len, unsigned long prot, struct file * file = NULL; unsigned long error = -EFAULT; - lock_kernel(); if (!(flags & MAP_ANONYMOUS)) { error = -EBADF; file = fget(fd); @@ -71,7 +68,6 @@ sys_mmap(unsigned long addr, size_t len, unsigned long prot, if (file) fput(file); out: - unlock_kernel(); return error; } diff --git a/arch/mips64/lib/dump_tlb.c b/arch/mips64/lib/dump_tlb.c index 4d0de2b0f..7ac575a15 100644 --- a/arch/mips64/lib/dump_tlb.c +++ b/arch/mips64/lib/dump_tlb.c @@ -133,28 +133,28 @@ dump_list_process(struct task_struct *t, void *address) pgd_t *page_dir, *pgd; pmd_t *pmd; pte_t *pte, page; - unsigned int addr; + unsigned long addr; unsigned long val; - addr = (unsigned int) address; + addr = (unsigned long) address; - printk("Addr == %08x\n", addr); - printk("tasks->mm.pgd == %08x\n", (unsigned int) t->mm->pgd); + printk("Addr == %08lx\n", addr); + printk("tasks->mm.pgd == %08lx\n", (unsigned long) t->mm->pgd); page_dir = pgd_offset(t->mm, 0); - printk("page_dir == %08x\n", (unsigned int) page_dir); + printk("page_dir == %08lx\n", (unsigned long) page_dir); pgd = pgd_offset(t->mm, addr); - printk("pgd == %08x, ", (unsigned int) pgd); + printk("pgd == %08lx, ", (unsigned long) pgd); pmd = pmd_offset(pgd, addr); - printk("pmd == %08x, ", (unsigned int) pmd); + printk("pmd == %08lx, ", (unsigned long) pmd); pte = pte_offset(pmd, addr); - printk("pte == %08x, ", (unsigned int) pte); + printk("pte == %08lx, ", (unsigned long) pte); page = *pte; - printk("page == %08x\n", (unsigned int) pte_val(page)); + printk("page == %08lx\n", (unsigned long) pte_val(page)); val = pte_val(page); if (val & _PAGE_PRESENT) printk("present "); diff --git a/arch/mips64/mm/fault.c b/arch/mips64/mm/fault.c index c17c89336..204419e98 100644 --- a/arch/mips64/mm/fault.c +++ b/arch/mips64/mm/fault.c @@ -40,7 +40,8 @@ extern void die(char *, struct pt_regs *, unsigned long write); asmlinkage void dodebug(abi64_no_regargs, struct pt_regs regs) { - printk("Got syscall %d, cpu %d proc %s:%d epc 0x%lx\n", regs.regs[2], smp_processor_id(), current->comm, current->pid, regs.cp0_epc); + printk("Got syscall %ld, cpu %d proc %s:%d epc 0x%lx\n", regs.regs[2], + smp_processor_id(), current->comm, current->pid, regs.cp0_epc); } asmlinkage void @@ -142,7 +143,6 @@ bad_area: while(1); } if (user_mode(regs)) { - struct siginfo si; tsk->thread.cp0_badvaddr = address; tsk->thread.error_code = write; #if 0 diff --git a/arch/mips64/sgi-ip27/ip27-berr.c b/arch/mips64/sgi-ip27/ip27-berr.c index b4b594baa..fade5a7af 100644 --- a/arch/mips64/sgi-ip27/ip27-berr.c +++ b/arch/mips64/sgi-ip27/ip27-berr.c @@ -1,5 +1,4 @@ -/* $Id: ip27-berr.c,v 1.1 2000/01/20 22:50:29 ralf Exp $ - * +/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. @@ -14,6 +13,9 @@ #include <asm/sn/sn0/hub.h> #include <asm/uaccess.h> +extern void dump_tlb_addr(unsigned long addr); +extern void dump_tlb_all(void); + extern asmlinkage void handle_ibe(void); extern asmlinkage void handle_dbe(void); diff --git a/arch/mips64/sgi-ip27/ip27-irq.c b/arch/mips64/sgi-ip27/ip27-irq.c index 6b148bca7..36a656ca0 100644 --- a/arch/mips64/sgi-ip27/ip27-irq.c +++ b/arch/mips64/sgi-ip27/ip27-irq.c @@ -1,9 +1,8 @@ -/* $Id: ip27-irq.c,v 1.9 2000/03/14 01:39:27 ralf Exp $ - * +/* * ip27-irq.c: Highlevel interrupt handling for IP27 architecture. * - * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org) - * Copyright (C) 1999 Silicon Graphics, Inc. + * Copyright (C) 1999, 2000 Ralf Baechle (ralf@gnu.org) + * Copyright (C) 1999, 2000 Silicon Graphics, Inc. */ #include <linux/init.h> @@ -285,8 +284,8 @@ void irq_debug(void) printk("bridge->b_int_status = 0x%x\n", bridge->b_int_status); printk("bridge->b_int_enable = 0x%x\n", bridge->b_int_enable); - printk("PI_INT_PEND0 = 0x%x\n", LOCAL_HUB_L(PI_INT_PEND0)); - printk("PI_INT_MASK0_A = 0x%x\n", LOCAL_HUB_L(PI_INT_MASK0_A)); + printk("PI_INT_PEND0 = 0x%lx\n", LOCAL_HUB_L(PI_INT_PEND0)); + printk("PI_INT_MASK0_A = 0x%lx\n", LOCAL_HUB_L(PI_INT_MASK0_A)); } int setup_irq(unsigned int irq, struct irqaction *new) @@ -668,11 +667,14 @@ void handle_resched_intr(int irq, void *dev_id, struct pt_regs *regs) /* Nothing, the return from intr will work for us */ } +extern void smp_call_function_interrupt(void); + void install_cpuintr(int cpu) { - int irq; - extern void smp_call_function_interrupt(void); +#ifdef CONFIG_SMP +#if (CPUS_PER_NODE == 2) static int done = 0; + int irq; /* * This is a hack till we have a pernode irqlist. Currently, @@ -680,8 +682,6 @@ void install_cpuintr(int cpu) * cpu irqs. */ -#ifdef CONFIG_SMP -#if (CPUS_PER_NODE == 2) irq = CPU_RESCHED_A_IRQ + cputoslice(cpu); intr_connect_level(cpu, IRQ_TO_SWLEVEL(cpu, irq)); if (done == 0) diff --git a/arch/ppc/8260_io/uart.c b/arch/ppc/8260_io/uart.c index ff91c6a45..caa5ca8b0 100644 --- a/arch/ppc/8260_io/uart.c +++ b/arch/ppc/8260_io/uart.c @@ -2318,10 +2318,6 @@ int __init rs_8xx_init(void) volatile iop8260_t *io; init_bh(SERIAL_BH, do_serial_bh); -#if 0 - timer_table[RS_TIMER].fn = rs_8xx_timer; - timer_table[RS_TIMER].expires = 0; -#endif show_serial_version(); diff --git a/arch/ppc/8xx_io/uart.c b/arch/ppc/8xx_io/uart.c index 0c53be922..00f4fa86c 100644 --- a/arch/ppc/8xx_io/uart.c +++ b/arch/ppc/8xx_io/uart.c @@ -2437,10 +2437,6 @@ int __init rs_8xx_init(void) volatile immap_t *immap; init_bh(SERIAL_BH, do_serial_bh); -#if 0 - timer_table[RS_TIMER].fn = rs_8xx_timer; - timer_table[RS_TIMER].expires = 0; -#endif show_serial_version(); diff --git a/arch/ppc/config.in b/arch/ppc/config.in index f72735bc2..33f6eaa95 100644 --- a/arch/ppc/config.in +++ b/arch/ppc/config.in @@ -183,7 +183,7 @@ if [ "$CONFIG_APUS" = "y" ]; then fi endmenu - +source drivers/mtd/Config.in source drivers/pnp/Config.in source drivers/block/Config.in #source drivers.new/Config.in diff --git a/arch/ppc/kernel/syscalls.c b/arch/ppc/kernel/syscalls.c index e31b34cc9..08d0bc44b 100644 --- a/arch/ppc/kernel/syscalls.c +++ b/arch/ppc/kernel/syscalls.c @@ -184,9 +184,7 @@ asmlinkage int sys_pipe(int *fildes) int fd[2]; int error; - lock_kernel(); error = do_pipe(fd); - unlock_kernel(); if (!error) { if (copy_to_user(fildes, fd, 2*sizeof(int))) error = -EFAULT; @@ -201,7 +199,6 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len, struct file * file = NULL; int ret = -EBADF; - lock_kernel(); if (!(flags & MAP_ANONYMOUS)) { if (!(file = fget(fd))) goto out; @@ -214,7 +211,6 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len, if (file) fput(file); out: - unlock_kernel(); return ret; } diff --git a/arch/s390/config.in b/arch/s390/config.in index 9e946365f..96686af33 100644 --- a/arch/s390/config.in +++ b/arch/s390/config.in @@ -57,6 +57,9 @@ fi source fs/Config.in +# Not sure about this one. dwmw2 +# source drivers/mtd/Config.in + # source drivers/char/Config.in mainmenu_option next_comment diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c index 268ea007a..b00d88a62 100644 --- a/arch/s390/kernel/sys_s390.c +++ b/arch/s390/kernel/sys_s390.c @@ -37,9 +37,7 @@ asmlinkage int sys_pipe(unsigned long * fildes) int fd[2]; int error; - lock_kernel(); error = do_pipe(fd); - unlock_kernel(); if (!error) { if (copy_to_user(fildes, fd, 2*sizeof(int))) error = -EFAULT; @@ -64,11 +62,7 @@ static inline long do_mmap2( } down(¤t->mm->mmap_sem); - lock_kernel(); - error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); - - unlock_kernel(); up(¤t->mm->mmap_sem); if (file) diff --git a/arch/sh/config.in b/arch/sh/config.in index f67a029e0..025e8a8ea 100644 --- a/arch/sh/config.in +++ b/arch/sh/config.in @@ -113,6 +113,8 @@ source drivers/parport/Config.in endmenu +source drivers/mtd/Config.in + source drivers/block/Config.in if [ "$CONFIG_NET" = "y" ]; then diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c index 0b3d5fc2e..64007b236 100644 --- a/arch/sh/kernel/sys_sh.c +++ b/arch/sh/kernel/sys_sh.c @@ -35,9 +35,7 @@ asmlinkage int sys_pipe(unsigned long r4, unsigned long r5, int fd[2]; int error; - lock_kernel(); error = do_pipe(fd); - unlock_kernel(); if (!error) { regs.regs[1] = fd[1]; return fd[0]; @@ -60,10 +58,7 @@ do_mmap2(unsigned long addr, unsigned long len, unsigned long prot, } down(¤t->mm->mmap_sem); - lock_kernel(); - error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); - unlock_kernel(); up(¤t->mm->mmap_sem); if (file) diff --git a/arch/sparc/config.in b/arch/sparc/config.in index 3ed5915ba..6513c6ad7 100644 --- a/arch/sparc/config.in +++ b/arch/sparc/config.in @@ -73,6 +73,8 @@ bool 'PROM console' CONFIG_PROM_CONSOLE source drivers/video/Config.in endmenu +source drivers/mtd/Config.in + if [ "$CONFIG_SUN4" != "y" ]; then source drivers/sbus/char/Config.in source drivers/sbus/audio/Config.in diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c index 82d3027aa..04358e900 100644 --- a/arch/sparc/kernel/sys_sparc.c +++ b/arch/sparc/kernel/sys_sparc.c @@ -1,4 +1,4 @@ -/* $Id: sys_sparc.c,v 1.63 2000/06/22 11:42:25 davem Exp $ +/* $Id: sys_sparc.c,v 1.64 2000/06/26 23:20:24 davem Exp $ * linux/arch/sparc/kernel/sys_sparc.c * * This file contains various random system calls that @@ -81,14 +81,12 @@ asmlinkage int sparc_pipe(struct pt_regs *regs) int fd[2]; int error; - lock_kernel(); error = do_pipe(fd); if (error) goto out; regs->u_regs[UREG_I1] = fd[1]; error = fd[0]; out: - unlock_kernel(); return error; } @@ -215,7 +213,6 @@ static unsigned long do_mmap2(unsigned long addr, unsigned long len, goto out; } - lock_kernel(); retval = -EINVAL; len = PAGE_ALIGN(len); if (ARCH_SUN4C_SUN4 && @@ -234,7 +231,6 @@ static unsigned long do_mmap2(unsigned long addr, unsigned long len, up(¤t->mm->mmap_sem); out_putf: - unlock_kernel(); if (file) fput(file); out: diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c index f64563cab..77565401f 100644 --- a/arch/sparc/kernel/sys_sunos.c +++ b/arch/sparc/kernel/sys_sunos.c @@ -1,4 +1,4 @@ -/* $Id: sys_sunos.c,v 1.125 2000/06/22 11:42:25 davem Exp $ +/* $Id: sys_sunos.c,v 1.126 2000/06/26 23:20:24 davem Exp $ * sys_sunos.c: SunOS specific syscall compatibility support. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) @@ -68,7 +68,6 @@ asmlinkage unsigned long sunos_mmap(unsigned long addr, unsigned long len, struct file * file = NULL; unsigned long retval, ret_type; - lock_kernel(); if(flags & MAP_NORESERVE) { static int cnt; if (cnt++ < 10) @@ -127,7 +126,6 @@ out_putf: if (file) fput(file); out: - unlock_kernel(); return retval; } @@ -363,7 +361,6 @@ asmlinkage int sunos_getdents(unsigned int fd, void * dirent, int cnt) if (!file) goto out; - lock_kernel(); error = -EINVAL; if (cnt < (sizeof(struct sunos_dirent) + 255)) goto out_putf; @@ -385,7 +382,6 @@ asmlinkage int sunos_getdents(unsigned int fd, void * dirent, int cnt) } out_putf: - unlock_kernel(); fput(file); out: return error; @@ -444,7 +440,6 @@ asmlinkage int sunos_getdirentries(unsigned int fd, void * dirent, int cnt, unsi if (!file) goto out; - lock_kernel(); error = -EINVAL; if(cnt < (sizeof(struct sunos_direntry) + 255)) goto out_putf; @@ -466,7 +461,6 @@ asmlinkage int sunos_getdirentries(unsigned int fd, void * dirent, int cnt, unsi } out_putf: - unlock_kernel(); fput(file); out: return error; diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c index 6bb5e9964..213ff8b1e 100644 --- a/arch/sparc/mm/srmmu.c +++ b/arch/sparc/mm/srmmu.c @@ -125,7 +125,7 @@ int srmmu_cache_pagetables; void *srmmu_nocache_pool; void *srmmu_nocache_bitmap; int srmmu_nocache_low; -int srmmu_nocache_used; +unsigned long srmmu_nocache_used; spinlock_t srmmu_nocache_spinlock; /* This makes sense. Honest it does - Anton */ @@ -1127,8 +1127,6 @@ void __init srmmu_inherit_prom_mappings(unsigned long start,unsigned long end) } } -static unsigned long end_of_phys_memory __initdata = 0; - #define KERNEL_PTE(page_shifted) ((page_shifted)|SRMMU_CACHE|SRMMU_PRIV|SRMMU_VALID) /* Create a third-level SRMMU 16MB page mapping. */ @@ -1268,8 +1266,8 @@ static int srmmu_mmu_info(char *buf) return sprintf(buf, "MMU type\t: %s\n" "contexts\t: %d\n" - "nocache total\t: %d\n" - "nocache used\t: %d\n" + "nocache total\t: %lu\n" + "nocache used\t: %lu\n" , srmmu_name, num_contexts, SRMMU_NOCACHE_SIZE, diff --git a/arch/sparc64/config.in b/arch/sparc64/config.in index 8bf06e44f..1a12dd236 100644 --- a/arch/sparc64/config.in +++ b/arch/sparc64/config.in @@ -78,7 +78,7 @@ endmenu source drivers/sbus/char/Config.in source drivers/sbus/audio/Config.in - +source drivers/mtd/Config.in mainmenu_option next_comment comment 'Block devices' diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig index d4a7c4b53..7ecaa1a9f 100644 --- a/arch/sparc64/defconfig +++ b/arch/sparc64/defconfig @@ -85,6 +85,7 @@ CONFIG_FB_PM2_PCI=y CONFIG_FB_ATY=y # CONFIG_FB_ATY128 is not set # CONFIG_FB_3DFX is not set +# CONFIG_FB_SIS is not set CONFIG_FB_SBUS=y CONFIG_FB_CREATOR=y CONFIG_FB_CGSIX=y @@ -429,7 +430,6 @@ CONFIG_NFS_V3=y # CONFIG_ROOT_NFS is not set CONFIG_NFSD=m CONFIG_NFSD_V3=y -# CONFIG_NFSD_TCP is not set CONFIG_SUNRPC=y CONFIG_LOCKD=y CONFIG_LOCKD_V4=y diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c index eb6f789f6..a4904efb3 100644 --- a/arch/sparc64/kernel/irq.c +++ b/arch/sparc64/kernel/irq.c @@ -1,4 +1,4 @@ -/* $Id: irq.c,v 1.87 2000/05/09 17:40:13 davem Exp $ +/* $Id: irq.c,v 1.88 2000/06/26 19:40:27 davem Exp $ * irq.c: UltraSparc IRQ handling/init/registry. * * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) @@ -62,6 +62,19 @@ unsigned int __up_workvec[16] __attribute__ ((aligned (64))); #define irq_work(__cpu, __pil) &(cpu_data[(__cpu)].irq_worklists[(__pil)]) #endif +#ifdef CONFIG_PCI +/* This is a table of physical addresses used to deal with SA_DMA_SYNC. + * It is used for PCI only to synchronize DMA transfers with IRQ delivery + * for devices behind busses other than APB on Sabre systems. + * + * Currently these physical addresses are just config space accesses + * to the command register for that device. + */ +unsigned long pci_dma_wsync; +unsigned long dma_sync_reg_table[256]; +unsigned char dma_sync_reg_table_entry = 0; +#endif + /* This is based upon code in the 32-bit Sparc kernel written mostly by * David Redman (djhr@tadpole.co.uk). */ @@ -280,8 +293,6 @@ int request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *) /* * Check wether we _should_ use DMA Write Sync * (for devices behind bridges behind APB). - * - * XXX: Not implemented, yet. */ if (bucket->flags & IBF_DMA_SYNC) irqflags |= SA_DMA_SYNC; @@ -719,14 +730,14 @@ void handler_irq(int irq, struct pt_regs *regs) /* 'cpu' is the MID (ie. UPAID), calculate the MID * of our buddy. */ - if(should_forward != 0) { + if (should_forward != 0) { buddy = cpu_number_map(cpu) + 1; if (buddy >= NR_CPUS || (buddy = cpu_logical_map(buddy)) == -1) buddy = cpu_logical_map(0); /* Voo-doo programming. */ - if(cpu_data[buddy].idle_volume < FORWARD_VOLUME) + if (cpu_data[buddy].idle_volume < FORWARD_VOLUME) should_forward = 0; buddy <<= 26; } @@ -752,25 +763,29 @@ void handler_irq(int irq, struct pt_regs *regs) #else bp = __bucket(xchg32(irq_work(cpu, irq), 0)); #endif - for( ; bp != NULL; bp = nbp) { + for ( ; bp != NULL; bp = nbp) { unsigned char flags = bp->flags; nbp = __bucket(bp->irq_chain); - if((flags & IBF_ACTIVE) != 0) { - if((flags & IBF_MULTI) == 0) { + if ((flags & IBF_ACTIVE) != 0) { + if ((flags & IBF_DMA_SYNC) != 0) { + upa_readl(dma_sync_reg_table[bp->synctab_ent]); + upa_readq(pci_dma_wsync); + } + if ((flags & IBF_MULTI) == 0) { struct irqaction *ap = bp->irq_info; ap->handler(__irq(bp), ap->dev_id, regs); } else { void **vector = (void **)bp->irq_info; int ent; - for(ent = 0; ent < 4; ent++) { + for (ent = 0; ent < 4; ent++) { struct irqaction *ap = vector[ent]; - if(ap != NULL) + if (ap != NULL) ap->handler(__irq(bp), ap->dev_id, regs); } } /* Only the dummy bucket lacks IMAP/ICLR. */ - if(bp->pil != 0) { + if (bp->pil != 0) { #ifdef CONFIG_SMP /* Ok, here is what is going on: * 1) Retargeting IRQs on Starfire is very diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c index 99f7ba8ad..f3a5adbec 100644 --- a/arch/sparc64/kernel/pci_sabre.c +++ b/arch/sparc64/kernel/pci_sabre.c @@ -1,4 +1,4 @@ -/* $Id: pci_sabre.c,v 1.19 2000/04/15 13:07:51 davem Exp $ +/* $Id: pci_sabre.c,v 1.20 2000/06/26 19:40:27 davem Exp $ * pci_sabre.c: Sabre specific PCI controller support. * * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@caipfs.rutgers.edu) @@ -641,14 +641,28 @@ static unsigned int __init sabre_irq_build(struct pci_controller_info *p, bucket = __bucket(build_irq(pil, inofixup, iclr, imap)); bucket->flags |= IBF_PCI; - /* XXX We still need to code up support for this in irq.c - * XXX It's easy to code up since only one SIMBA can exist - * XXX in a machine and this is where the sync register is. -DaveM - */ if (pdev) { struct pcidev_cookie *pcp = pdev->sysdata; - if (pdev->bus->number != pcp->pbm->pci_first_busno) + + /* When a device lives behind a bridge deeper in the + * PCI bus topology than APB, a special sequence must + * run to make sure all pending DMA transfers at the + * time of IRQ delivery are visible in the coherency + * domain by the cpu. This sequence is to perform + * a read on the far side of the non-APB bridge, then + * perform a read of Sabre's DMA write-sync register. + * + * Currently, the PCI_CONFIG register for the device + * is used for this read from the far side of the bridge. + */ + if (pdev->bus->number != pcp->pbm->pci_first_busno) { bucket->flags |= IBF_DMA_SYNC; + bucket->synctab_ent = dma_sync_reg_table_entry++; + dma_sync_reg_table[bucket->synctab_ent] = + (unsigned long) sabre_pci_config_mkaddr( + pcp->pbm, + pdev->bus->number, pdev->devfn, PCI_COMMAND); + } } return __irq(bucket); } @@ -1399,7 +1413,10 @@ void __init sabre_init(int pnode) * First REG in property is base of entire SABRE register space. */ p->controller_regs = pr_regs[0].phys_addr; - printk("PCI: Found SABRE, main regs at %016lx\n", p->controller_regs); + pci_dma_wsync = p->controller_regs + SABRE_WRSYNC; + + printk("PCI: Found SABRE, main regs at %016lx, wsync at %016lx\n", + p->controller_regs, pci_dma_wsync); /* Error interrupts are enabled later after the bus scan. */ sabre_write(p->controller_regs + SABRE_PCICTRL, diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c index 2aff3033a..42ba3907b 100644 --- a/arch/sparc64/kernel/sys_sparc.c +++ b/arch/sparc64/kernel/sys_sparc.c @@ -1,4 +1,4 @@ -/* $Id: sys_sparc.c,v 1.41 2000/06/22 11:42:25 davem Exp $ +/* $Id: sys_sparc.c,v 1.42 2000/06/26 23:20:24 davem Exp $ * linux/arch/sparc64/kernel/sys_sparc.c * * This file contains various random system calls that @@ -92,14 +92,12 @@ asmlinkage int sparc_pipe(struct pt_regs *regs) int fd[2]; int error; - lock_kernel(); error = do_pipe(fd); if (error) goto out; regs->u_regs[UREG_I1] = fd[1]; error = fd[0]; out: - unlock_kernel(); return error; } @@ -227,8 +225,6 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, len = PAGE_ALIGN(len); retval = -EINVAL; - lock_kernel(); - if (current->thread.flags & SPARC_FLAG_32BIT) { if (len > 0xf0000000UL || ((flags & MAP_FIXED) && addr > 0xf0000000UL - len)) @@ -245,7 +241,6 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, up(¤t->mm->mmap_sem); out_putf: - unlock_kernel(); if (file) fput(file); out: diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c index e27892de3..607633aec 100644 --- a/arch/sparc64/kernel/sys_sparc32.c +++ b/arch/sparc64/kernel/sys_sparc32.c @@ -1,4 +1,4 @@ -/* $Id: sys_sparc32.c,v 1.152 2000/06/22 17:44:47 davem Exp $ +/* $Id: sys_sparc32.c,v 1.153 2000/06/26 23:20:24 davem Exp $ * sys_sparc32.c: Conversion between 32bit and 64bit native syscalls. * * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) @@ -1266,14 +1266,12 @@ asmlinkage int old32_readdir(unsigned int fd, struct old_linux_dirent32 *dirent, buf.count = 0; buf.dirent = dirent; - lock_kernel(); error = vfs_readdir(file, fillonedir, &buf); if (error < 0) goto out_putf; error = buf.count; out_putf: - unlock_kernel(); fput(file); out: return error; @@ -1333,7 +1331,6 @@ asmlinkage int sys32_getdents(unsigned int fd, struct linux_dirent32 *dirent, un buf.count = count; buf.error = 0; - lock_kernel(); error = vfs_readdir(file, filldir, &buf); if (error < 0) goto out_putf; @@ -1344,7 +1341,6 @@ asmlinkage int sys32_getdents(unsigned int fd, struct linux_dirent32 *dirent, un error = count - buf.count; } out_putf: - unlock_kernel(); fput(file); out: return error; @@ -1587,7 +1583,6 @@ asmlinkage int sys32_newstat(char * filename, struct stat32 *statbuf) struct nameidata nd; int error; - lock_kernel(); error = user_path_walk(filename, &nd); if (!error) { struct inode *inode = nd.dentry->d_inode; @@ -1602,7 +1597,6 @@ asmlinkage int sys32_newstat(char * filename, struct stat32 *statbuf) path_release(&nd); } - unlock_kernel(); return error; } @@ -1611,7 +1605,6 @@ asmlinkage int sys32_newlstat(char * filename, struct stat32 *statbuf) struct nameidata nd; int error; - lock_kernel(); error = user_path_walk_link(filename, &nd); if (!error) { struct inode *inode = nd.dentry->d_inode; @@ -1626,7 +1619,6 @@ asmlinkage int sys32_newlstat(char * filename, struct stat32 *statbuf) path_release(&nd); } - unlock_kernel(); return error; } @@ -1635,15 +1627,13 @@ asmlinkage int sys32_newfstat(unsigned int fd, struct stat32 *statbuf) struct file *f; int err = -EBADF; - lock_kernel(); f = fget(fd); if (f) { - struct dentry *dentry = f->f_dentry; - struct inode *inode = dentry->d_inode; + struct inode *inode = f->f_dentry->d_inode; if (inode->i_op && inode->i_op->revalidate) - err = inode->i_op->revalidate(dentry); + err = inode->i_op->revalidate(f->f_dentry); else err = 0; if (!err) @@ -1651,7 +1641,6 @@ asmlinkage int sys32_newfstat(unsigned int fd, struct stat32 *statbuf) fput(f); } - unlock_kernel(); return err; } diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c index 70adfe21a..bad3d5e2f 100644 --- a/arch/sparc64/kernel/sys_sunos32.c +++ b/arch/sparc64/kernel/sys_sunos32.c @@ -1,4 +1,4 @@ -/* $Id: sys_sunos32.c,v 1.49 2000/06/22 11:42:25 davem Exp $ +/* $Id: sys_sunos32.c,v 1.50 2000/06/26 23:20:24 davem Exp $ * sys_sunos32.c: SunOS binary compatability layer on sparc64. * * Copyright (C) 1995, 1996, 1997 David S. Miller (davem@caip.rutgers.edu) @@ -68,7 +68,6 @@ asmlinkage u32 sunos_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u32 of struct file *file = NULL; unsigned long retval, ret_type; - lock_kernel(); if(flags & MAP_NORESERVE) { static int cnt; if (cnt++ < 10) @@ -113,7 +112,6 @@ out_putf: if (file) fput(file); out: - unlock_kernel(); return (u32) retval; } @@ -321,8 +319,6 @@ asmlinkage int sunos_getdents(unsigned int fd, u32 u_dirent, int cnt) if(!file) goto out; - lock_kernel(); - error = -EINVAL; if(cnt < (sizeof(struct sunos_dirent) + 255)) goto out_putf; @@ -344,7 +340,6 @@ asmlinkage int sunos_getdents(unsigned int fd, u32 u_dirent, int cnt) } out_putf: - unlock_kernel(); fput(file); out: return error; @@ -406,8 +401,6 @@ asmlinkage int sunos_getdirentries(unsigned int fd, u32 u_dirent, if(!file) goto out; - lock_kernel(); - error = -EINVAL; if(cnt < (sizeof(struct sunos_direntry) + 255)) goto out_putf; @@ -429,7 +422,6 @@ asmlinkage int sunos_getdirentries(unsigned int fd, u32 u_dirent, } out_putf: - unlock_kernel(); fput(file); out: return error; diff --git a/arch/sparc64/mm/modutil.c b/arch/sparc64/mm/modutil.c index 8ae715c38..b8e2833f0 100644 --- a/arch/sparc64/mm/modutil.c +++ b/arch/sparc64/mm/modutil.c @@ -1,4 +1,4 @@ -/* $Id: modutil.c,v 1.5 2000/05/23 23:09:08 davem Exp $ +/* $Id: modutil.c,v 1.6 2000/06/26 23:20:24 davem Exp $ * arch/sparc64/mm/modutil.c * * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) @@ -58,7 +58,7 @@ void * module_map (unsigned long size) area->next = *p; *p = area; - if (vmalloc_area_pages(VMALLOC_VMADDR(addr), size, GFP_KERNEL)) { + if (vmalloc_area_pages(VMALLOC_VMADDR(addr), size, GFP_KERNEL, PAGE_KERNEL)) { vfree(addr); return NULL; } diff --git a/arch/sparc64/solaris/fs.c b/arch/sparc64/solaris/fs.c index 6c19f8577..f4a9df85d 100644 --- a/arch/sparc64/solaris/fs.c +++ b/arch/sparc64/solaris/fs.c @@ -480,14 +480,12 @@ asmlinkage int solaris_statvfs(u32 path, u32 buf) struct nameidata nd; int error; - lock_kernel(); error = user_path_walk((const char *)A(path),&nd); if (!error) { struct inode * inode = nd.dentry->d_inode; error = report_statvfs(inode, buf); path_release(&nd); } - unlock_kernel(); return error; } @@ -499,9 +497,7 @@ asmlinkage int solaris_fstatvfs(unsigned int fd, u32 buf) error = -EBADF; file = fget(fd); if (file) { - lock_kernel(); error = report_statvfs(file->f_dentry->d_inode, buf); - unlock_kernel(); fput(file); } diff --git a/arch/sparc64/solaris/misc.c b/arch/sparc64/solaris/misc.c index eaa8fed32..4878a2366 100644 --- a/arch/sparc64/solaris/misc.c +++ b/arch/sparc64/solaris/misc.c @@ -54,7 +54,6 @@ static u32 do_solaris_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u64 o struct file *file = NULL; unsigned long retval, ret_type; - lock_kernel(); /* Do we need it here? */ set_personality(PER_SVR4); if (flags & MAP_NORESERVE) { @@ -107,7 +106,6 @@ out_putf: if (file) fput(file); out: - unlock_kernel(); return (u32) retval; } |