]> git.neil.brown.name Git - history.git/commitdiff
Import 1.1.71 1.1.71
authorLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:09:46 +0000 (15:09 -0500)
committerLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:09:46 +0000 (15:09 -0500)
52 files changed:
Configure
Makefile
arch/i386/boot/head.S
arch/i386/config.in
arch/sparc/boot/boot.S [new file with mode: 0644]
arch/sparc/boot/boot.h [new file with mode: 0644]
arch/sparc/boot/version.h [new file with mode: 0644]
drivers/block/ll_rw_blk.c
drivers/net/Makefile
drivers/scsi/53c7,8xx.c
drivers/scsi/Makefile
drivers/scsi/aha1740.c
drivers/scsi/buslogic.c
drivers/scsi/hosts.c
drivers/scsi/hosts.h
drivers/scsi/scsi.c
drivers/scsi/scsi.h
drivers/scsi/sg.c
fs/Makefile
fs/devices.c
fs/proc/array.c
fs/proc/root.c
fs/sysv/Makefile
fs/sysv/inode.c
fs/xiafs/Makefile
fs/xiafs/inode.c
include/asm-alpha/types.h
include/asm-i386/system.h
include/asm-i386/types.h
include/asm-m68k/bitops.h [new file with mode: 0644]
include/asm-m68k/delay.h [new file with mode: 0644]
include/asm-m68k/dma.h [new file with mode: 0644]
include/asm-m68k/io.h [new file with mode: 0644]
include/asm-m68k/irq.h [new file with mode: 0644]
include/asm-m68k/segment.h [new file with mode: 0644]
include/asm-m68k/string.h [new file with mode: 0644]
include/asm-m68k/system.h [new file with mode: 0644]
include/asm-m68k/unistd.h [new file with mode: 0644]
include/linux/elf.h
include/linux/pci.h
include/linux/proc_fs.h
include/linux/sched.h
init/main.c
kernel/bios32.c
kernel/ksyms.c
kernel/printk.c
kernel/sched.c
kernel/time.c
mm/memory.c
net/inet/skbuff.c
net/inet/sock.c
net/inet/tcp.c

index 22fffb16ed1d843068fe9815c9f19366bce4b725..0281b3df29b2e906cf8b7d521e52652aab12040c 100644 (file)
--- a/Configure
+++ b/Configure
@@ -43,18 +43,6 @@ function readln () {
        fi
 }
 
-#
-# change updates the "config.new" file according to the answer
-#
-#      change define old new
-#
-function change () {
-       if [ "$2" != "$3" ]; then
-               sed "s/$1 $2$/$1 $3/" < $CONFIG_NEW > .tmpc
-               mv .tmpc $CONFIG_NEW
-       fi
-}
-
 #
 # comment does some pretty-printing
 #
@@ -73,17 +61,17 @@ function comment () {
 #
 function bool () {
        ans=""
+       def=$(eval echo "\${$2:-$3}")
        while [ "$ans" != "y" -a "$ans" != "n" ]; do
-               readln "$1 ($2) [$3] " "$3"
+               readln "$1 ($2) [$def] " "$def"
        done
        if [ "$ans" = "y" ]; then
-               echo "  $2 = $2" >>$CONFIG
+               echo "$2=y" >>$CONFIG
                echo "#define $2 1" >>$CONFIG_H
        else
                echo "# $2 is not set" >>$CONFIG
                echo "#undef  $2" >>$CONFIG_H
        fi
-       change $2 $3 $ans
        eval "$2=$ans"
 }
 
@@ -95,23 +83,22 @@ function bool () {
 function int () {
        # Slimier hack to get bash to rescan a line.
        ans="x"
+       def=$(eval echo "\${$2:-$3}")
        while [ $[$ans+0] != "$ans" ]; do
-               readln "$1 ($2) [$3] " "$3"
+               readln "$1 ($2) [$def] " "$def"
        done
-       echo "  $2 = $ans" >>$CONFIG
+       echo "$2=$ans" >>$CONFIG
        echo "#define $2 ($ans)" >>$CONFIG_H
        eval "$2=$ans"
 }
 
 CONFIG=.tmpconfig
 CONFIG_H=.tmpconfig.h
-CONFIG_NEW=config.new
-trap "rm -f $CONFIG $CONFIG_H $CONFIG_NEW ; exit 1" 1 2
+trap "rm -f $CONFIG $CONFIG_H ; exit 1" 1 2
 
 #
 # Make sure we start out with a clean slate.
 #
-cp config.in $CONFIG_NEW
 echo "#" > $CONFIG
 echo "# Automatically generated make config: don't edit" >> $CONFIG
 echo "#" >> $CONFIG
@@ -122,16 +109,24 @@ echo " */" >> $CONFIG_H
 
 DEFAULT=$1
 
+if [ -f ./.config ] ; then
+       . ./.config
+       sed -e 's/# \(.*\) is not.*/\1=n/' <./.config >/tmp/conf.$$
+       . /tmp/conf.$$
+       rm /tmp/conf.$$
+fi
 . ./config.in
 
 if [ "$CONFIG_SOUND" = "y" ] ; then
        $MAKE -C drivers/sound config || exit 1
 fi
 
+rm -f .config.old
+if [ -f .config ]; then
+       mv .config .config.old
+fi
 mv .tmpconfig .config
 mv .tmpconfig.h include/linux/autoconf.h
-mv config.in config.old
-mv config.new config.in
 
 echo
 echo "The linux kernel is now hopefully configured for your setup."
index 035206caf76b908f93ad231deb9e59f24c9bb8e7..7ba5d96ef35d9b5a2e714b331315567d9aad08b9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 1
 PATCHLEVEL = 1
-SUBLEVEL = 70
+SUBLEVEL = 71
 
 ARCH = i386
 
index 896c62f18240309b08c87047bdb2f5934ec5ffa5..4a322bb18cee09da579ee75ed29209b6146f9f2e 100644 (file)
@@ -95,8 +95,6 @@ startup_32:
  * apply at our cpl of 0 and the stack ought to be aligned already, and
  * we don't need to preserve eflags.
  */
-       movl %esp,%edi          # save stack pointer
-       andl $0xfffffffc,%esp   # align stack to avoid AC fault
        movl $3,_x86
        pushfl                  # push EFLAGS
        popl %eax               # get EFLAGS
@@ -121,26 +119,31 @@ startup_32:
        je is486
 isnew: pushl %ecx              # restore original EFLAGS
        popfl
+       /* get processor type */
        movl $1, %eax           # Use the CPUID instruction to 
        .byte 0x0f, 0xa2        # check the processor type
        andl $0xf00, %eax       # Set _x86 with the family
        shrl $8, %eax           # returned.     
        movl %eax, _x86
-       movl %edi,%esp          # restore esp
+       /* get vendor info */
+       xorl %eax, %eax                 # call CPUID with 0 -> return vendor ID
+       .byte 0x0f, 0xa2                # CPUID
+       movl %ebx, _x86_vendor_id       # lo 4 chars
+       movl %edx, _x86_vendor_id+4     # next 4 chars
+       movl %ecx, _x86_vendor_id+8     # last 4 chars
+
        movl %cr0,%eax          # 486+
        andl $0x80000011,%eax   # Save PG,PE,ET
        orl $0x50022,%eax       # set AM, WP, NE and MP
        jmp 2f
 is486: pushl %ecx              # restore original EFLAGS
        popfl
-       movl %edi,%esp          # restore esp
        movl %cr0,%eax          # 486
        andl $0x80000011,%eax   # Save PG,PE,ET
        orl $0x50022,%eax       # set AM, WP, NE and MP
        jmp 2f
 is386: pushl %ecx              # restore original EFLAGS
        popfl
-       movl %edi,%esp          # restore esp
        movl %cr0,%eax          # 386
        andl $0x80000011,%eax   # Save PG,PE,ET
        orl $2,%eax             # set MP
index 2f1ba4012b0372d208f1e85fd8fa745abd0f0517..57b62b55203f1f6344a6fac17f62c1bc5923e43d 100644 (file)
@@ -31,9 +31,9 @@ comment 'Networking options'
 bool 'TCP/IP networking' CONFIG_INET y
 if [ "$CONFIG_INET" "=" "y" ]; then
 bool 'IP forwarding/gatewaying' CONFIG_IP_FORWARD n
-#bool 'IP multicasting (ALPHA)' CONFIG_IP_MULTICAST n
-#bool 'IP firewalling' CONFIG_IP_FIREWALL n
-#bool 'IP accounting' CONFIG_IP_ACCT n
+bool 'IP multicasting (ALPHA)' CONFIG_IP_MULTICAST n
+bool 'IP firewalling' CONFIG_IP_FIREWALL n
+bool 'IP accounting' CONFIG_IP_ACCT n
 comment '(it is safe to leave these untouched)'
 bool 'PC/TCP compatibility mode' CONFIG_INET_PCTCP n
 bool 'Reverse ARP' CONFIG_INET_RARP n
@@ -100,6 +100,7 @@ bool 'Dummy net driver support' CONFIG_DUMMY n
 bool 'SLIP (serial line) support' CONFIG_SLIP n
 if [ "$CONFIG_SLIP" = "y" ]; then
   bool ' CSLIP compressed headers' SL_COMPRESSED y
+  bool ' 16 channels instead of 4' SL_SLIP_LOTS n
 #  bool ' SLIP debugging on' SL_DUMP y
 fi
 bool 'PPP (point-to-point) support' CONFIG_PPP n
@@ -112,9 +113,6 @@ if [ "$CONFIG_NET_VENDOR_SMC" = "y" ]; then
        bool 'SMC Ultra support' CONFIG_ULTRA n
 fi
 bool 'AMD LANCE and PCnet (AT1500 and NE2100) support' CONFIG_LANCE n
-if [ "$CONFIG_LANCE" = "y" ]; then
-       bool '   with PCnet/PCI support' CONFIG_PCI y
-fi
 bool '3COM cards' CONFIG_NET_VENDOR_3COM y
 if [ "$CONFIG_NET_VENDOR_3COM" = "y" ]; then
        bool '3c501 support' CONFIG_EL1 n
diff --git a/arch/sparc/boot/boot.S b/arch/sparc/boot/boot.S
new file mode 100644 (file)
index 0000000..83a28bb
--- /dev/null
@@ -0,0 +1,454 @@
+#include "boot.h"
+#include "version.h"
+
+       .data
+
+/* First thing to go in the data segment is the interrupt stack */
+
+        .globl  _intstack
+        .globl  _eintstack
+_intstack:
+        .skip   4 * NBPG                ! 16k = 128 128-byte stack frames
+_eintstack:
+
+
+
+/* 
+   The following are used with the prom_vector node-ops to figure out
+   the cpu-type 
+*/
+
+        .globl  _cputyp
+
+_cputyp:
+        .word   1
+
+_cputypval:
+       .asciz "sun4c"
+       .ascii "     "
+
+_cputypvar:
+       .asciz "compatability"
+
+_cputypvallen = _cputypvar - _cputypval
+
+
+/* WARNING: evil messages follow */
+
+       .align 4
+
+sun4_notsup:
+       .asciz  "Sparc-Linux: sun4 support not implemented yet\n\n"
+       .align 4
+
+sun4m_notsup:
+        .asciz  "Sparc-Linux: sun4m support does not exist\n\n"
+       .align 4
+
+sun4d_notsup:
+        .asciz  "Sparc-Linux: sun4d support does not exist\n\n"
+       .align 4
+
+
+/* The following will disappear real soon as the implementation is easy */
+
+v2_prom_notyet:
+       .asciz  "Sparc-Linux: v2 boot-prom support not implemented\n\n"
+       .align 4
+
+
+/*
+   Fill up the prom vector, note in particular the kind first element,
+   no joke.
+*/
+
+                       .globl _prom_vector_p
+
+_prom_vector_p:                .skip 4
+prom_magic:            .skip 4                 ! magic mushroom, beware...
+prom_rom_vers:                 .skip 4                 ! interface version (v0 or v2)
+prom_pluginvers:       .skip 4                 ! XXX help help help
+prom_revision:         .skip 4                 ! PROM revision (ie. 1.4)
+prom_bootstr:          .skip 4                 ! what we are invoked with
+prom_putchar:          .skip 4                 ! void putchar(int ch)  BLOCKING.
+prom_getchar:          .skip 4                 ! int getchar(void)     BLOCKING.
+prom_nputchar:         .skip 4                 ! int purchar(int ch)   non-block
+prom_ngetchar:         .skip 4                 ! int getchar(void)     non-block
+prom_halt:             .skip 4                 ! void halt(void)  solaris friend
+prom_eval:             .skip 4                 ! void eval(int len, char* string)
+prom_v0mem_desc:       .skip 4                 ! V0 memory descriptor list ptr.
+prom_nodefuncs:                .skip 4                 ! Magical Node functions
+prom_v0devfuncs:       .skip 4                 ! V0 device operations
+prom_putstring:                .skip 4                 ! prom putstring()
+prom_bootme:           .skip 4                 ! reset()
+prom_printf:           .skip 4                 ! minimal printf()
+prom_abort:            .skip 4                 ! "L1-A" magic cookie
+                                               ! must be mapped in ALL contexts
+prom_ticks:            .skip 4                 ! number of ticks since reset
+prom_sync:             .skip 4                 ! hook in prom for "sync" func
+prom_v0bootarg:                .skip 4                 ! v0 prom boot arguements
+prom_v2bootarg:                .skip 4                 ! same as above for v2 proms
+prom_ethaddr_func:     .skip 4                 ! extract ethernet device address
+prom_v2devfunc:                .skip 4                 ! ptr to v2 style device ops.
+prom_xtra_array:       .skip 4                 ! who knows :-( help help
+prom_setcontext:       .skip 4                 ! set context on sun4c
+prom_stdin:            .skip 4                 ! prom stdin magic cookie
+prom_stdout:           .skip 4                 ! prom stdout magic cookie
+
+
+       .align 4
+
+       .globl boot_msg
+
+/*
+   This gets forth eval'd, just 'cause I think forth is neat to have in a boot
+   monitor :-) We may not need no steenkin BIOS but we do need the prom!
+*/
+
+boot_msg:      
+       .ascii "Booting Sparc-Linux V0.00PRE-ALPHA (SUN4C) "
+       .ascii WHO_COMPILED_ME 
+       .asciz " \n"
+       .align 4
+
+       .globl boot_msg2
+
+boot_msg2:
+       .asciz "Booting Sparclinux V0.00 PRE-ALPHA on a (SUN4C)\n\n"
+
+       .align 4
+
+pstring1:
+       .asciz "Prom Magic Cookie: 0x%x  "
+       .align 4
+
+pstring2:
+       .asciz "Interface Version: v%d\n"
+       .align 4
+
+pstring3:
+       .asciz "Prom Revision: V%d\n\n"
+       .align 4
+
+pstring4:
+       .ascii "Total Physical Memory: %d bytes\nVM mapped by Prom: %d bytes\n"
+       .asciz "Available Physical Memory: %d bytes\n"
+       .align 4
+
+
+newline:
+       .asciz "\n"
+       .align 4
+
+       .text
+
+        .globl  _msgbuf
+msgbufsize = NBPG                       ! 1 page for msg buffer
+_msgbuf = KERNBASE + NBPG
+
+
+IE_reg_addr = _msgbuf + msgbufsize      ! this page not used; points to IEreg
+
+/*
+   ignore the following variable settings, I used them when I had
+   no stinkin idea what the linker was doing with the symbols to
+   get them in the right place for load time
+*/
+
+whereis_bootmsg = boot_msg-KERNBASE
+whereis_kernbase = KERNBASE
+whereis_prom_vector_p = _prom_vector_p-KERNBASE
+whereis_prom_eval = prom_eval-KERNBASE
+whereis_prom_halt = prom_halt-KERNBASE
+       
+       .globl  start
+       .globl  _trapbase
+start:
+_trapbase:
+       b dostart; nop; nop; nop        ! we never get trap #0 it is special
+                                       ! TRAP code should go here, TODO :>
+
+_msgbufmapped:
+        .word   1
+
+
+        .data
+        .skip   32                      ! alignment byte & negative indicies
+uwtab:  .skip   32                      ! u_char uwtab[-31..31];
+wmask:  .skip   32                      ! u_char wmask[0..31];
+
+        .text
+       
+
+       
+dostart:       mov     %o0, %g7
+               st      %o0, [_prom_vector_p]   ! we will need it later
+               ld      [%g7 + 0x4], %o2
+               cmp     %o2, 2                  ! a v2 prom?
+               be      _no_v2_here
+               nop
+
+               set     0x4000, %g6
+               cmp     %o0, %g6                ! an old sun4?
+               beq     no_sun4_here
+               nop
+
+               ld      [%g7 + 0x1c], %o4
+               ld      [%o4], %o4
+               call    %o4
+               mov     0, %o0
+               set     _cputypvar, %o1
+               set     _cputypval, %o2
+               ld      [%g7 + 0x1c], %o4
+               ld      [%o4 + 0x0c], %o4
+               call    %o4
+               nop
+
+               set     _cputypval, %o2
+               ldub    [%o2 + 4], %o0
+               cmp     %o0, 'c'
+               beq     is_sun4c
+               nop
+               cmp     %o0, 'm'
+               beq     no_sun4m_here
+               nop
+               b       no_sun4d_here
+               nop
+
+is_sun4c:                                      ! OK, this is a sun4c, yippie
+               mov     %g7, %g6                ! load up them promvec offsets
+               st      %g6, [prom_magic]       ! magic mushroom :>
+               add     %g7, 0x4, %g6
+               st      %g6, [prom_rom_vers]
+               add     %g7, 0x8, %g6
+               st      %g6, [prom_pluginvers]
+               add     %g7, 0xc, %g6
+               st      %g6, [prom_revision]
+               add     %g7, 0x10, %g6
+               st      %g6, [prom_v0mem_desc]
+               add     %g7, 0x1c, %g6
+               st      %g6, [prom_nodefuncs]
+               add     %g7, 0x20, %g6
+               st      %g6, [prom_bootstr]
+               add     %g7, 0x24, %g6
+               st      %g6, [prom_v0devfuncs]
+               add     %g7, 0x48, %g6
+               st      %g6, [prom_stdin]
+               add     %g7, 0x4c, %g6
+               st      %g6, [prom_stdout]
+               add     %g7, 0x54, %g6
+               st      %g6, [prom_putchar]
+               add     %g7, 0x50, %g6
+               st      %g6, [prom_getchar]
+               add     %g7, 0x5c, %g6
+               st      %g6, [prom_nputchar]
+               add     %g7, 0x58, %g6
+               st      %g6, [prom_ngetchar]
+               add     %g7, 0x60, %g6
+               st      %g6, [prom_putstring]
+               add     %g7, 0x64, %g6
+               st      %g6, [prom_bootme]
+               add     %g7, 0x68, %g6
+               st      %g6, [prom_printf]
+               add     %g7, 0x6c, %g6
+               st      %g6, [prom_abort]
+               add     %g7, 0x70, %g6
+               st      %g6, [prom_ticks]
+               add     %g7, 0x74, %g6
+               st      %g6, [prom_halt]
+               add     %g7, 0x78, %g6
+               st      %g6, [prom_sync]
+               add     %g7, 0x7c, %g6
+               st      %g6, [prom_eval]
+               add     %g7, 0x80, %g6
+               st      %g6, [prom_v0bootarg]
+               add     %g7, 0x84, %g6
+               st      %g6, [prom_ethaddr_func]
+               add     %g7, 0x88, %g6
+               st      %g6, [prom_v2bootarg]
+               add     %g7, 0x98, %g6
+               st      %g6, [prom_v2devfunc]
+               add     %g7, 0xc8, %g6
+               st      %g6, [prom_xtra_array]
+               add     %g7, 0x104, %g6
+               st      %g6, [prom_setcontext]
+
+
+               set     boot_msg-KERNBASE, %o0  
+               ld      [prom_printf-KERNBASE], %o2
+               ld      [%o2], %o1
+               call    %o1                     ! print boot message #1
+               nop
+               set     newline-KERNBASE, %o0
+               ld      [prom_printf-KERNBASE], %o2
+               ld      [%o2], %o1
+               call    %o1
+               nop
+
+               b       0f
+               nop
+
+
+0:             nop                             ! duh   
+               set     pstring1-KERNBASE, %o0
+               ld      [prom_printf-KERNBASE], %o3
+               ld      [%o3], %o2
+               ld      [prom_magic-KERNBASE], %o3
+               ld      [%o3], %o1
+               call    %o2
+               nop; nop; nop
+
+               set     pstring2-KERNBASE, %o0
+               ld      [prom_printf-KERNBASE], %o3
+               ld      [%o3], %o2
+               ld      [prom_rom_vers-KERNBASE], %o3
+               ld      [%o3], %o1
+               call    %o2
+               nop; nop; nop
+
+               set     pstring4-KERNBASE, %o0
+               ld      [prom_printf-KERNBASE], %o5
+               ld      [%o5], %o4
+               ld      [_prom_vector_p], %l1
+               ld      [%l1+16], %l2
+               ld      [%l2], %l3
+               ld      [%l3 + 8], %o1
+
+/*
+               ld      [%l1], %l2
+               ld      [%l2 + 0x8], %o1    ! physical memory accumulator
+*/
+               ld      [_prom_vector_p], %l1
+               ld      [%l1 + 16], %l2
+               ld      [%l2], %l3
+               ld      [%l3], %l4
+
+/*             ld      [%l3], %l4  */
+memloop:
+               cmp     %l4, 0
+               be      mv_to_vmprom            ! is there more?
+               nop
+
+               ld      [%l4 + 0x8], %l6        ! aparently so...
+               add     %o1, %l6, %o1
+               b       memloop
+               ld      [%l4], %l4
+
+mv_to_vmprom:
+
+               ld      [_prom_vector_p], %l0
+               ld      [%l0 + 20], %l1
+               ld      [%l1], %l2
+               ld      [%l2 + 8], %o2          ! memory accumulator
+
+               ld      [_prom_vector_p], %l0
+               ld      [%l0 + 20], %l1
+               ld      [%l1], %l2
+               ld      [%l2], %l4
+
+memloop2:
+               cmp     %l4, 0
+               be      mv_to_vmprom2           ! is there more?
+               nop
+               ld      [%l4 + 0x8], %l6        ! aparently so...
+               add     %o2, %l6, %o2
+               b       memloop2
+               ld      [%l4], %l4
+
+mv_to_vmprom2:
+
+               ld      [_prom_vector_p], %l0
+               ld      [%l0 + 24], %l1
+               ld      [%l1], %l2
+               ld      [%l2 + 8], %o3          ! memory accumulator
+
+               ld      [_prom_vector_p], %l0
+               ld      [%l0 + 24], %l1
+               ld      [%l1], %l2
+               ld      [%l2], %l4
+
+memloop3:
+               cmp     %l4, 0
+               be      mv_to_vmprom3           ! is there more?
+               nop
+               ld      [%l4 + 0x8], %l6        ! aparently so...
+               add     %o3, %l6, %o3
+               b       memloop3
+               ld      [%l4], %l4
+
+mv_to_vmprom3:
+
+               call    %o4
+               nop; nop; nop
+
+
+               set     newline-KERNBASE, %o0
+               ld      [prom_printf-KERNBASE], %o2
+               ld      [%o2], %o1
+               call    %o1
+               nop
+
+               b       halt_me
+               nop
+
+               .globl _no_v2_here
+_no_v2_here:
+               ld      [%g7 + 0x68], %o1
+               set     v2_prom_notyet-KERNBASE, %o0
+               call    %o1
+               nop
+               b       halt_me
+               nop
+
+no_sun4_here:
+               ld      [%g7 + 0x68], %o1
+               set     sun4_notsup, %o0
+               call    %o1
+               nop
+               b       halt_me
+               nop
+
+no_sun4m_here:
+               ld      [%g7 + 0x68], %o1
+               set     sun4m_notsup, %o0
+               call    %o1
+               nop
+               b       halt_me
+               nop
+
+no_sun4d_here:
+               ld      [%g7 + 0x68], %o1
+               set     sun4d_notsup, %o0
+               call    %o1
+               nop
+               b       halt_me
+               nop
+
+halt_me:
+               ld      [%g7 + 0x74], %o0
+               call    %o0                     ! get us out of here...
+               nop                             ! aparently solaris is better
+
+_strlen:
+               mov     %o0, %l1
+               mov     %g0, %l3
+               ldub    [%l1], %l2
+               sll     %l2, 24, %l2
+               sra     %l2, 24, %l2
+len_loop:
+               cmp     %l2, 0
+               be      len_loop_end
+               nop
+               add     %l3, 0x1, %l3
+               add     %l1, 0x1, %l1
+               ldub    [%l1], %l2
+               sll     %l2, 24, %l2
+               sra     %l2, 24, %l2
+               b       len_loop
+               nop
+
+len_loop_end:
+               mov     %l3, %o0
+               ret
+               nop
+               
diff --git a/arch/sparc/boot/boot.h b/arch/sparc/boot/boot.h
new file mode 100644 (file)
index 0000000..9e11fa6
--- /dev/null
@@ -0,0 +1,6 @@
+#define KERNSIZE       134217728
+#define KERNBASE       -134217728
+#define NBPG           4096    
+#define UPAGES         2
+#define PROM_BASE      -1568768
+
diff --git a/arch/sparc/boot/version.h b/arch/sparc/boot/version.h
new file mode 100644 (file)
index 0000000..0c238e9
--- /dev/null
@@ -0,0 +1 @@
+#define WHO_COMPILED_ME "someone@somewhere.domain"
index 05fcf157dbdc33399f0b818a82d62cad12758bf5..621f84a91974a4adbbacbcc0badf6742cac5a911 100644 (file)
@@ -219,6 +219,10 @@ static void make_request(int major,int rw, struct buffer_head * bh)
                        bh->b_req = 0;
                        return;
                }
+       /* Uhhuh.. Nasty dead-lock possible here.. */
+       if (bh->b_lock)
+               return;
+       /* Maybe the above fixes it, and maybe it doesn't boot. Life is interesting */
        lock_buffer(bh);
        if ((rw == WRITE && !bh->b_dirt) || (rw == READ && bh->b_uptodate)) {
                unlock_buffer(bh);
index 3df08613013d2dd156e5fbe68bd19e80d85fea48..1e8d5b580ef20907f131343612230a162fdf8325 100644 (file)
@@ -180,8 +180,7 @@ endif
 
 net.a: $(NETDRV_OBJS)
        rm -f net.a
-       ar rc net.a $(NETDRV_OBJS)
-       ranlib net.a
+       ar rcs net.a $(NETDRV_OBJS)
 
 clean:
        rm -f core *.o *.a *.s
index 99a7d360d1de134176e716686186c58580f0022d..7904e699d7091c9fd4bf6356500b442f837608a9 100644 (file)
@@ -276,16 +276,17 @@ static char scan_scsis_buf[512];
  */
 
 struct pci_chip {
-    short pci_device_id;
+    unsigned short pci_device_id;
     int chip;
     int max_revision;
     int min_revision;
 };
 
-static struct pci_chip pci_chip_ids[3] = { 
+static struct pci_chip pci_chip_ids[] = { 
     {PCI_DEVICE_ID_NCR_53C810, 810, 1, 1}, 
+    {PCI_DEVICE_ID_NCR_53C815, 815, 2, 3},
     {PCI_DEVICE_ID_NCR_53C820, 820, -1, -1},
-    {PCI_DEVICE_ID_NCR_53C825, 825, -1, -1},
+    {PCI_DEVICE_ID_NCR_53C825, 825, -1, -1}
 };
 
 #define NPCI_CHIP_IDS (sizeof (pci_chip_ids) / sizeof(pci_chip_ids[0]))
@@ -413,6 +414,7 @@ static int NCR53c7x0_init (struct Scsi_Host *host) {
     switch (hostdata->chip) {
     case 810:
     case 815:
+    case 820:
     case 825:
        hostdata->dstat_sir_intr = NCR53c8x0_dstat_sir_intr;
        hostdata->init_save_regs = NULL;
index d4500bee3de281a2b6be1ef85cee6af246a919c0..698b0aefd7604b117e01f3229c520a7760af0769 100644 (file)
@@ -6,9 +6,6 @@
 # unless its something special (ie not a .c file).
 #
 
-#AHA152X       = -DDEBUG -DAUTOCONF -DIRQ=11 -DSCSI_ID=7 -DRECONNECT=0 \
-#          -DPORTBASE=0x340 -DSKIP_BIOSTEST -DDONT_SNARF
-
 AHA152X        = -DDEBUG_AHA152X -DAUTOCONF
 
 ifeq (${CFLAGS},)
index baf310de486066693af9d105c74a33f32cfd23b7..eedbfc6b3e5d653cc8e4ae35e18edbaf7a4c345e 100644 (file)
@@ -197,6 +197,12 @@ void aha1740_intr_handle(int foo)
                continue;
            }
            SCtmp = ecbptr->SCpnt;
+           if (!SCtmp)
+           {
+               printk("Aha1740 null SCtmp in interrupt (%x,%x,%x,%d)\n",
+                       inb(G2STAT),adapstat,inb(G2INTST),number_serviced++);
+               continue;
+           }
            if (SCtmp->host_scribble)
                scsi_free(SCtmp->host_scribble, 512);
          /* Fetch the sense data, and tuck it away, in the required slot.  The
index bd19d7eda72aca0b4eb5f76af7000bfa9bf93299..6121b45805b14a1a03d0c23e4651013a93ea2603 100644 (file)
@@ -1215,8 +1215,8 @@ int buslogic_detect(Scsi_Host_Template *tpnt)
            if (bus_type == 'V'                             /* 445 */
                && firmware_rev[0] <= '3'                   /* S */
                && bios != NULL) {                          /* BIOS enabled */
-#if 0
-               /* ??? Once LNZ's forbidden_addr stuff makes it into the higher
+#if 1
+               /* Now that LNZ's forbidden_addr stuff makes it into the higher
                   level scsi code, we can use this instead. */
                /* Avoid addresses which "mirror" the BIOS for DMA. */
                shpnt->forbidden_addr = bios;
index 9e836b915f96f628713c766da3570fdf28e4cbca..f8ac33051bcf23787f2266c1e49f9851924664ec 100644 (file)
@@ -236,6 +236,8 @@ struct Scsi_Host * scsi_register(Scsi_Host_Template * tpnt, int j){
        retval->host_wait = NULL;       
        retval->last_reset = 0; 
        retval->irq = 0;
+       retval->forbidden_addr = 0;
+       retval->forbidden_size = 0;
        retval->hostt = tpnt;   
        retval->next = NULL;
 #ifdef DEBUG
@@ -328,3 +330,21 @@ unsigned int scsi_init()
        max_scsi_hosts = count;
        return 0;
 }
+
+
+void scsi_mem_init(unsigned long memory_end)
+{
+  struct Scsi_Host *Host;
+  long High8, Low24;
+  for (Host = scsi_hostlist; Host != NULL; Host = Host->next)
+    if (Host->forbidden_addr > 0 && Host->forbidden_size > 0)
+      for (High8 = 1<<24; High8 < memory_end; High8 += 1<<24)
+       for (Low24 = Host->forbidden_addr;
+            Low24 < Host->forbidden_addr + Host->forbidden_size;
+            Low24 += PAGE_SIZE)
+         {
+           unsigned long ForbiddenAddress = High8 + Low24;
+           if (ForbiddenAddress >= memory_end) break;
+           mem_map[MAP_NR(ForbiddenAddress)] = MAP_PAGE_RESERVED;
+         }
+}
index fa690d97259d2eb69de72a17e3de8e4bc96174bd..20259643f9847b77e37fb1e62dc103246b84ceb1 100644 (file)
@@ -252,10 +252,19 @@ struct Scsi_Host
                unsigned char n_io_port;
                unsigned char irq;
                unsigned char dma_channel;
+
+               /*
+                 Set these if there are conflicts between memory
+                 in the < 1mb region and regions at 16mb multiples.
+                 The address must be on a page boundary.
+               */
+               unsigned long forbidden_addr;
+               unsigned long forbidden_size;
+
                /*
                  The rest can be copied from the template, or specifically
                  initialized, as required.
-                 */
+               */
                
                int this_id;
                int can_queue;
@@ -264,7 +273,7 @@ struct Scsi_Host
                unsigned unchecked_isa_dma:1;
                /*
                   True if this host was loaded as a loadable module
-                  */
+               */
                unsigned loaded_as_module:1;
                
                int hostdata[0];  /* Used for storage of host specific stuff */
index a46a30dd6bc96807202cb9997154bc1a8f112982..a26668536a5881883ece485ddc4db03e5bd31048 100644 (file)
@@ -41,7 +41,7 @@ const unsigned char scsi_command_size[8] = { 6, 10, 10, 12, 12, 12, 10, 10 };
 static void scsi_done (Scsi_Cmnd *SCpnt);
 static int update_timeout (Scsi_Cmnd *, int);
 static void print_inquiry(unsigned char *data);
-static void scsi_times_out (Scsi_Cmnd * SCpnt);
+static void scsi_times_out (Scsi_Cmnd * SCpnt, int pid);
 
 static int time_start;
 static int time_elapsed;
@@ -525,7 +525,7 @@ static void scan_scsis (struct Scsi_Host * shpnt)
        command, that failing perform a kernel panic.
 */ 
 
-static void scsi_times_out (Scsi_Cmnd * SCpnt)
+static void scsi_times_out (Scsi_Cmnd * SCpnt, int pid)
        {
        
        switch (SCpnt->internal_timeout & (IN_ABORT | IN_RESET))
@@ -537,7 +537,7 @@ static void scsi_times_out (Scsi_Cmnd * SCpnt)
 #endif
                        }
                        
-                       if (!scsi_abort (SCpnt, DID_TIME_OUT))
+                       if (!scsi_abort (SCpnt, DID_TIME_OUT, pid))
                                return;                         
                case IN_ABORT:
                        printk("SCSI host %d abort() timed out - resetting\n",
@@ -837,8 +837,6 @@ static void scsi_request_sense (Scsi_Cmnd * SCpnt)
        SCpnt->use_sg = 0;
        SCpnt->cmd_len = COMMAND_SIZE(SCpnt->cmnd[0]);
        internal_cmnd (SCpnt);
-       SCpnt->use_sg = SCpnt->old_use_sg;
-       SCpnt->cmd_len = SCpnt->old_cmd_len;
        }
 
 
@@ -1085,6 +1083,13 @@ static void scsi_done (Scsi_Cmnd * SCpnt)
 #ifdef DEBUG
        printk("In scsi_done(host = %d, result = %06x)\n", host->host_no, result);
 #endif
+
+       if(SCpnt->flags & WAS_SENSE)
+       {
+               SCpnt->use_sg = SCpnt->old_use_sg;
+               SCpnt->cmd_len = SCpnt->old_cmd_len;
+       }
+
        switch (host_byte(result))      
        {
        case DID_OK:
@@ -1400,7 +1405,7 @@ static void scsi_done (Scsi_Cmnd * SCpnt)
 */
 
 
-int scsi_abort (Scsi_Cmnd * SCpnt, int why)
+int scsi_abort (Scsi_Cmnd * SCpnt, int why, int pid)
        {
        int oldto;
        struct Scsi_Host * host = SCpnt->host;
@@ -1408,6 +1413,16 @@ int scsi_abort (Scsi_Cmnd * SCpnt, int why)
        while(1)        
                {
                cli();
+
+               /*
+                * Protect against races here.  If the command is done, or we are
+                * on a different command forget it.
+                */
+               if (SCpnt->request.dev == -1 || pid != SCpnt->pid) {
+                 sti();
+                 return 0;
+               }
+
                if (SCpnt->internal_timeout & IN_ABORT) 
                        {
                        sti();
@@ -1436,6 +1451,8 @@ int scsi_abort (Scsi_Cmnd * SCpnt, int why)
                               SCpnt->pid, SCpnt->host->host_no, (int) SCpnt->target, (int) 
                               SCpnt->lun);
                        print_command (SCpnt->cmnd);
+                       if (SCpnt->request.dev == -1 || pid != SCpnt->pid)
+                         return 0;
                        SCpnt->abort_reason = why;
                        switch(host->hostt->abort(SCpnt)) {
                          /* We do not know how to abort.  Try waiting another
@@ -1473,6 +1490,7 @@ int scsi_abort (Scsi_Cmnd * SCpnt, int why)
                             need to adjust timeout */
                        case SCSI_ABORT_NOT_RUNNING:
                          SCpnt->internal_timeout &= ~IN_ABORT;
+                         update_timeout(SCpnt, 0);
                          return 0;
                        case SCSI_ABORT_ERROR:
                        default:
@@ -1513,7 +1531,7 @@ int scsi_reset (Scsi_Cmnd * SCpnt)
 #if 0                            
                                    if (!(SCpnt1->flags & IS_RESETTING) && 
                                      !(SCpnt1->internal_timeout & IN_ABORT))
-                                   scsi_abort(SCpnt1, DID_RESET);
+                                   scsi_abort(SCpnt1, DID_RESET, SCpnt->pid);
 #endif
                                    SCpnt1->flags |= IS_RESETTING;
                                  }
@@ -1576,7 +1594,7 @@ static void scsi_main_timeout(void)
                We must not enter update_timeout with a timeout condition still pending.
        */
 
-       int timed_out;
+       int timed_out, pid;
        struct Scsi_Host * host;
        Scsi_Cmnd * SCpnt = NULL;
 
@@ -1594,9 +1612,10 @@ static void scsi_main_timeout(void)
                  for(SCpnt = host->host_queue; SCpnt; SCpnt = SCpnt->next)
                    if (SCpnt->timeout == -1)
                      {
-                       sti();
                        SCpnt->timeout = 0;
-                       scsi_times_out(SCpnt);
+                       pid = SCpnt->pid;
+                       sti();
+                       scsi_times_out(SCpnt, SCpnt);
                        ++timed_out; 
                        cli();
                      }
index 9eb8398769c6ba5068af8a6306f5340c454c472f..83d7d55abbeb3b6acf03aa2e53d72fdb1b8708d1 100644 (file)
@@ -510,7 +510,7 @@ typedef struct scsi_cmnd {
        DID_ABORT is returned in the hostbyte.
 */
 
-extern int scsi_abort (Scsi_Cmnd *, int code);
+extern int scsi_abort (Scsi_Cmnd *, int code, int pid);
 
 extern void scsi_do_cmd (Scsi_Cmnd *, const void *cmnd ,
                   void *buffer, unsigned bufflen, void (*done)(struct scsi_cmnd *),
@@ -564,6 +564,7 @@ static Scsi_Cmnd * end_scsi_request(Scsi_Cmnd * SCpnt, int uptodate, int sectors
                up(req->sem);
        }
        req->dev = -1;
+       wake_up(&wait_for_request);
        wake_up(&SCpnt->device->device_wait);
        return NULL;
 }
index c8bf96cfefe18ba1f9d67ae9df09501297008763..71c0ffaf13d436b96023ee8ef22e6624184b60ba 100644 (file)
@@ -108,7 +108,9 @@ static int sg_open(struct inode * inode, struct file * filp)
     }
   if (!scsi_generics[dev].users && scsi_generics[dev].pending && scsi_generics[dev].complete)
    {
-    scsi_free(scsi_generics[dev].buff,scsi_generics[dev].buff_len);
+    if (scsi_generics[dev].buff != NULL)
+      scsi_free(scsi_generics[dev].buff,scsi_generics[dev].buff_len);
+    scsi_generics[dev].buff=NULL;
     scsi_generics[dev].pending=0;
    }
   if (!scsi_generics[dev].users)
@@ -188,6 +190,7 @@ static int sg_read(struct inode *inode,struct file *filp,char *buf,int count)
   else
    count=0;
   sg_free(device->buff,device->buff_len);
+  device->buff = NULL;
   device->pending=0;
   wake_up(&device->write_wait);
   return count;
@@ -266,6 +269,7 @@ static int sg_write(struct inode *inode,struct file *filp,char *buf,int count)
     device->pending=0;
     wake_up(&device->write_wait);
     sg_free(device->buff,device->buff_len);
+    device->buff = NULL;
     return -EWOULDBLOCK;
    } 
 #ifdef DEBUG
@@ -370,6 +374,7 @@ static void sg_attach(Scsi_Device * SDp)
    scsi_generics[i].generic_wait=NULL;
    scsi_generics[i].read_wait=NULL;
    scsi_generics[i].write_wait=NULL;
+   scsi_generics[i].buff=NULL;
    scsi_generics[i].exclude=0;
    scsi_generics[i].pending=0;
    scsi_generics[i].timeout=SG_DEFAULT_TIMEOUT;
index c12ca8b0899327ed591ad6d2e921628a1531aee0..d9b58a525bb20c580845bdf42e6fdbcae984b2f4 100644 (file)
@@ -36,6 +36,8 @@ FS_SUBDIRS := $(FS_SUBDIRS) nfs
 endif
 ifdef CONFIG_XIA_FS
 FS_SUBDIRS := $(FS_SUBDIRS) xiafs
+else
+MODULE_FS_SUBDIRS := $(MODULE_FS_SUBDIRS) xiafs
 endif
 ifdef CONFIG_UMSDOS_FS
 FS_SUBDIRS := $(FS_SUBDIRS) umsdos
@@ -44,6 +46,8 @@ MODULE_FS_SUBDIRS := $(MODULE_FS_SUBDIRS) umsdos
 endif
 ifdef CONFIG_SYSV_FS
 FS_SUBDIRS := $(FS_SUBDIRS) sysv
+else
+MODULE_FS_SUBDIRS := $(MODULE_FS_SUBDIRS) sysv
 endif
 ifdef CONFIG_HPFS_FS
 FS_SUBDIRS := $(FS_SUBDIRS) hpfs
@@ -95,7 +99,8 @@ modules_fs:
        set -e; for i in $(MODULE_FS_SUBDIRS); do \
          test ! -d $$i || \
            { $(MAKE) -C $$i; }; done
-
+       (cd ../modules; \
+        for i in $(MODULE_FS_SUBDIRS); do ln -sf ../fs/$$i/$$i.o .; done)
 
 else
 
index e79ea07d5c9ca2d8029ca301a8d1a078c36454d6..3eb269295b335833610e0e233812c5bc7d968d26 100644 (file)
@@ -65,10 +65,6 @@ struct file_operations * get_chrfops(unsigned int major)
 int register_chrdev(unsigned int major, const char * name, struct file_operations *fops)
 {
        if (major == 0) {
-               for (major = MAX_CHRDEV-1; major > 0; major--) {
-                       if (chrdevs[major].fops == fops)
-                               return major;
-               }
                for (major = MAX_CHRDEV-1; major > 0; major--) {
                        if (chrdevs[major].fops == NULL) {
                                chrdevs[major].name = name;
@@ -90,10 +86,6 @@ int register_chrdev(unsigned int major, const char * name, struct file_operation
 int register_blkdev(unsigned int major, const char * name, struct file_operations *fops)
 {
        if (major == 0) {
-               for (major = MAX_BLKDEV-1; major > 0; major--) {
-                       if (blkdevs[major].fops == fops)
-                               return major;
-               }
                for (major = MAX_BLKDEV-1; major > 0; major--) {
                        if (blkdevs[major].fops == NULL) {
                                blkdevs[major].name = name;
index 6fd7bccbe6dca8b2fd5d0a0aa18f501529559bde..dba55e072df6b3e8f44b7b6c31c8c66c79409b38 100644 (file)
@@ -13,6 +13,9 @@
  *                      bad '!' which forced address recalculation for
  *                      EVERY character on the current page.
  *                      <middelin@polyware.iaf.nl>
+ *
+ * Danny ter Haar    : Some minor additions for cpuinfo
+ * <danny@ow.nl>
  */
 
 #include <linux/types.h>
@@ -176,6 +179,22 @@ static int get_version(char * buffer)
        return strlen(buffer);
 }
 
+static int get_cpuinfo(char * buffer)
+{
+       return sprintf(buffer,"cpu      : %d86\n"
+                             "vid      : %s\n"
+                             "fdiv_bug : %s\n"
+                             "math     : %s\n"
+                             "hlt      : %s\n"
+                             "wp       : %s\n",
+                             x86, 
+                             x86_vendor_id,
+                             fdiv_bug ? "yes" : "no",
+                             hard_math ? "yes" : "no",
+                             hlt_works_ok ? "yes" : "no",
+                             wp_works_ok ? "yes" : "no");
+}
+
 static struct task_struct ** get_task(pid_t pid)
 {
        struct task_struct ** p;
@@ -464,6 +483,7 @@ extern int get_filesystem_list(char *);
 extern int get_ksyms_list(char *);
 extern int get_irq_list(char *);
 extern int get_dma_list(char *);
+extern int get_cpuinfo(char *);
 
 static int get_root_array(char * page, int type)
 {
@@ -477,6 +497,9 @@ static int get_root_array(char * page, int type)
                case PROC_MEMINFO:
                        return get_meminfo(page);
 
+               case PROC_CPUINFO:
+                       return get_cpuinfo(page);
+
                case PROC_VERSION:
                        return get_version(page);
 
@@ -505,6 +528,7 @@ static int get_root_array(char * page, int type)
 
                case PROC_DMA:
                        return get_dma_list(page);
+
        }
        return -EBADF;
 }
index 97cf2ff256a1360ec1efff1b4d8414ae83fe5264..9dbddab7f9e366f0b3962bdf9656c5e3344d5a7b 100644 (file)
@@ -59,6 +59,7 @@ static struct proc_dir_entry root_dir[] = {
        { PROC_MEMINFO,         7, "meminfo" },
        { PROC_KMSG,            4, "kmsg" },
        { PROC_VERSION,         7, "version" },
+       { PROC_CPUINFO,         7, "cpuinfo" },
        { PROC_SELF,            4, "self" },    /* will change inode # */
        { PROC_NET,             3, "net" },
 #ifdef CONFIG_DEBUG_MALLOC
index d4a6ecbd4d0a6ae7747fb17ce8b2d3708add53b2..cd2772d10217f26d017aae90bb94ccd0daf59b63 100644 (file)
@@ -7,6 +7,10 @@
 #
 # Note 2! The CFLAGS definitions are now in the main makefile...
 
+ifndef CONFIG_SYSV_FS
+CFLAGS := $(CFLAGS) -DMODULE
+endif
+
 .c.s:
        $(CC) $(CFLAGS) -S $<
 .c.o:
index 0b61ae7c779529b3b45528e3de77546f7a28de9b..331b479d7d2922230d4d7528458ea5dee96cea3f 100644 (file)
 
 #include <asm/segment.h>
 
+#ifdef MODULE
+#include <linux/module.h>
+#include "../../tools/version.h"
+#else
+#define MOD_INC_USE_COUNT
+#define MOD_DEC_USE_COUNT
+#endif
+
 void sysv_put_inode(struct inode *inode)
 {
        if (inode->i_nlink)
@@ -348,6 +356,7 @@ struct super_block *sysv_read_super(struct super_block *sb,void *data,
                panic("Coherent FS: bad super-block size");
        if (64 != sizeof (struct sysv_inode))
                panic("sysv fs: bad i-node size");
+       MOD_INC_USE_COUNT;
        lock_super(sb);
        set_blocksize(dev,BLOCK_SIZE);
 
@@ -390,6 +399,8 @@ struct super_block *sysv_read_super(struct super_block *sb,void *data,
        unlock_super(sb);
        if (!silent)
                printk("VFS: unable to read Xenix/SystemV/Coherent superblock on device %d/%d\n",MAJOR(dev),MINOR(dev));
+       failed:
+       MOD_DEC_USE_COUNT;
        return NULL;
 
        ok:
@@ -413,7 +424,7 @@ struct super_block *sysv_read_super(struct super_block *sb,void *data,
                                sb->s_dev = 0;
                                unlock_super(sb);
                                printk("SysV FS: cannot read superblock in 1024 byte mode\n");
-                               return NULL;
+                               goto failed;
                }
        } else {
                /* Switch to another block size. Unfortunately, we have to
@@ -459,7 +470,7 @@ struct super_block *sysv_read_super(struct super_block *sb,void *data,
                                sb->s_dev = 0;
                                unlock_super(sb);
                                printk("SysV FS: cannot read superblock in 512 byte mode\n");
-                               return NULL;
+                               goto failed;
                }
        }
        sb->sv_ninodes = (sb->sv_firstdatazone - sb->sv_firstinodezone) << sb->sv_inodes_per_block_bits;
@@ -475,8 +486,8 @@ struct super_block *sysv_read_super(struct super_block *sb,void *data,
        sb->s_mounted = iget(sb,SYSV_ROOT_INO);
        unlock_super(sb);
        if (!sb->s_mounted) {
-               sysv_put_super(sb);
                printk("SysV FS: get root inode failed\n");
+               sysv_put_super(sb);
                return NULL;
        }
        sb->s_dirt = 1;
@@ -513,6 +524,7 @@ void sysv_put_super(struct super_block *sb)
                set_blocksize(sb->s_dev,BLOCK_SIZE);
        sb->s_dev = 0;
        unlock_super(sb);
+       MOD_DEC_USE_COUNT;
 }
 
 void sysv_statfs(struct super_block *sb, struct statfs *buf)
@@ -949,3 +961,39 @@ int sysv_sync_inode(struct inode * inode)
         return err;
 }
 
+#ifdef MODULE
+
+/* Every kernel module contains stuff like this. */
+
+char kernel_version[] = UTS_RELEASE;
+
+static struct file_system_type sysv_fs_type[3] = {
+       {sysv_read_super, "xenix", 1, NULL},
+       {sysv_read_super, "sysv", 1, NULL},
+       {sysv_read_super, "coherent", 1, NULL}
+};
+
+int init_module(void)
+{
+       int i;
+
+       for (i = 0; i < 3; i++)
+               register_filesystem(&sysv_fs_type[i]);
+
+       return 0;
+}
+
+void cleanup_module(void)
+{
+       int i;
+
+       if (MOD_IN_USE) {
+               printk("SysV FS cannot be removed, currently in use\n");
+               return;
+       }
+
+       for (i = 0; i < 3; i++)
+               unregister_filesystem(&sysv_fs_type[i]);
+}
+
+#endif
index 0975632441cd5614a9a44c141c348b4eaa459602..a50a7e8aa3fe70b70bc810fa90c16659132f733b 100644 (file)
@@ -7,6 +7,10 @@
 #
 # Note 2! The CFLAGS definitions are now in the main makefile...
 
+ifndef CONFIG_XIA_FS
+CFLAGS := $(CFLAGS) -DMODULE
+endif
+
 .c.s:
        $(CC) $(CFLAGS) -S $<
 .c.o:
index 171499a95cabe81665f361a5f02955683b34225c..7cb799aa47462738189ef564b4ce86abf829ef42 100644 (file)
 #include <asm/system.h>
 #include <asm/segment.h>
 
+#ifdef MODULE
+#include <linux/module.h>
+#include "../../tools/version.h"
+#else
+#define MOD_INC_USE_COUNT
+#define MOD_DEC_USE_COUNT
+#endif
+
 #include "xiafs_mac.h"
 
 static u_long random_nr;
@@ -43,6 +51,7 @@ void xiafs_put_super(struct super_block *sb)
     for(i = 0 ; i < _XIAFS_ZMAP_SLOTS ; i++)
         brelse(sb->u.xiafs_sb.s_zmap_buf[i]);
     unlock_super(sb);
+    MOD_DEC_USE_COUNT;
 }
 
 static struct super_operations xiafs_sops = { 
@@ -63,6 +72,7 @@ struct super_block *xiafs_read_super(struct super_block *s, void *data,
     struct xiafs_super_block *sp;
     int i, z, dev;
 
+    MOD_INC_USE_COUNT;
     dev=s->s_dev;
     lock_super(s);
 
@@ -72,6 +82,7 @@ struct super_block *xiafs_read_super(struct super_block *s, void *data,
         s->s_dev=0;
        unlock_super(s);
        printk("XIA-FS: read super_block failed (%s %d)\n", WHERE_ERR);
+       MOD_DEC_USE_COUNT;
        return NULL;
     }
     sp = (struct xiafs_super_block *) bh->b_data;
@@ -83,6 +94,7 @@ struct super_block *xiafs_read_super(struct super_block *s, void *data,
        if (!silent)
                printk("VFS: Can't find a xiafs filesystem on dev 0x%04x.\n",
                   dev);
+       MOD_DEC_USE_COUNT;
        return NULL;
     }
     s->s_blocksize = sp->s_zone_size;
@@ -93,7 +105,10 @@ struct super_block *xiafs_read_super(struct super_block *s, void *data,
       brelse(bh);
       set_blocksize(dev, s->s_blocksize);
       bh = bread (dev, 0,  s->s_blocksize);
-      if(!bh) return NULL;
+      if(!bh) {
+       MOD_DEC_USE_COUNT;
+       return NULL;
+      }
       sp = (struct xiafs_super_block *) (((char *)bh->b_data) + BLOCK_SIZE) ;
     };
     s->u.xiafs_sb.s_nzones = sp->s_nzones;
@@ -152,6 +167,7 @@ xiafs_read_super_fail:
     s->s_dev=0;
     unlock_super(s);
     printk("XIA-FS: read bitmaps failed (%s %d)\n", WHERE_ERR);
+    MOD_DEC_USE_COUNT;
     return NULL;
 }
 
@@ -500,3 +516,30 @@ int xiafs_sync_inode (struct inode *inode)
     brelse (bh);
     return err;
 }
+
+#ifdef MODULE
+
+/* Every kernel module contains stuff like this. */
+
+char kernel_version[] = UTS_RELEASE;
+
+static struct file_system_type xiafs_fs_type = {
+       xiafs_read_super, "xiafs", 1, NULL
+};
+
+int init_module(void)
+{
+       register_filesystem(&xiafs_fs_type);
+       return 0;
+}
+
+void cleanup_module(void)
+{
+       if (MOD_IN_USE) {
+               printk("XIA-FS cannot be removed, currently in use\n");
+               return;
+       }
+       unregister_filesystem(&xiafs_fs_type);
+}
+
+#endif
index 0cfafa43e9344663b109d25c70f3beb9464f57b9..eb02ab9faad92b28628dfef3303058be8205064b 100644 (file)
@@ -20,8 +20,10 @@ typedef unsigned int __u32;
  */
 #if ((~0UL) == 0xffffffff)
 
+#ifndef __STRICT_ANSI__
 typedef signed long long __s64;
 typedef unsigned long long __u64;
+#endif
 
 #else
 
index 04c8b96b6587aac0b3d704f6f407be43cd3f4e8f..ce5bd75e566790ccce2c4b291fda40e66e1ac0df 100644 (file)
@@ -18,8 +18,6 @@ __asm__ __volatile__ ("movl %%esp,%%eax\n\t" \
        "mov %%ax,%%gs" \
        : /* no outputs */ :"i" (USER_DS), "i" (USER_CS):"ax")
 
-#define sti() __asm__ __volatile__ ("sti": : :"memory")
-#define cli() __asm__ __volatile__ ("cli": : :"memory")
 #define nop() __asm__ __volatile__ ("nop")
 
 /*
@@ -44,6 +42,9 @@ extern inline int tas(char * m)
        return res;
 }
 
+#define sti() __asm__ __volatile__ ("sti": : :"memory")
+#define cli() __asm__ __volatile__ ("cli": : :"memory")
+
 #define save_flags(x) \
 __asm__ __volatile__("pushfl ; popl %0":"=r" (x): /* no input */ :"memory")
 
index a5197c3340e81b45a873cd285a69856d6d1575f7..c4534a80805cdb7012dc9f6cce6356e39651c7a6 100644 (file)
@@ -15,8 +15,10 @@ typedef unsigned short __u16;
 typedef signed long __s32;
 typedef unsigned long __u32;
 
+#ifndef __STRICT_ANSI__
 typedef signed long long __s64;
 typedef unsigned long long __u64;
+#endif
 
 /*
  * These aren't exported outside the kernel to avoid name space clashes
diff --git a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h
new file mode 100644 (file)
index 0000000..901fa48
--- /dev/null
@@ -0,0 +1,120 @@
+#ifndef _M68K_BITOPS_H
+#define _M68K_BITOPS_H
+/*
+ * Copyright 1992, Linus Torvalds.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file README.legal in the main directory of this archive
+ * for more details.
+ */
+
+/*
+ * Require 68020 or better.
+ *
+ * They don't use the standard m680x0 bit ordering.
+ * Instead, the use the standard m680x0 bitfield ordering.
+ *
+ * Thus, bit 0 is the MSB of addr; bit 32 is the MSB of (addr+1).
+ */
+
+extern __inline__ int set_bit(int nr,void * vaddr)
+{
+       char retval;
+
+       __asm__ __volatile__ ("bfset %2@{%1:#1}; sne %0"
+            : "=d" (retval) : "d" (nr), "a" (vaddr));
+
+       return retval;
+}
+
+extern __inline__ int clear_bit(int nr, void * vaddr)
+{
+       char retval;
+
+       __asm__ __volatile__ ("bfclr %2@{%1:#1}; sne %0"
+            : "=d" (retval) : "d" (nr), "a" (vaddr));
+
+       return retval;
+}
+
+extern __inline__ int change_bit(int nr, void * vaddr)
+{
+       char retval;
+
+       __asm__ __volatile__ ("bfchg %2@{%1:#1}; sne %0"
+            : "=d" (retval) : "d" (nr), "a" (vaddr));
+
+       return retval;
+}
+
+extern __inline__ int test_bit(int nr, const void * vaddr)
+{
+       char retval;
+
+       __asm__ __volatile__ ("bftst %2@{%1:#1}; sne %0"
+            : "=d" (retval) : "d" (nr), "a" (vaddr));
+
+       return retval;
+}
+
+extern inline int find_first_zero_bit(void * vaddr, unsigned size)
+{
+       unsigned long res;
+       unsigned long *p;
+       unsigned long *addr = vaddr;
+
+       if (!size)
+               return 0;
+       __asm__ __volatile__ ("    moveq #-1,d0\n\t"
+                             "1:"
+                             "    cmpl  %1@+,d0\n\t"
+                             "    bne   2f\n\t"
+                             "    subql #1,%0\n\t"
+                             "    bne   1b\n\t"
+                             "    bra   5f\n\t"
+                             "2:"
+                             "    movel %1@-,d0\n\t"
+                             "    notl  d0\n\t"
+                             "    bfffo d0{#0,#0},%0\n\t"
+                             "5:"
+                             : "=d" (res), "=a" (p)
+                             : "0" ((size + 31) >> 5), "1" (addr)
+                             : "d0");
+       return ((p - addr) << 5) + res;
+}
+
+static inline int find_next_zero_bit (void *vaddr, int size,
+                                     int offset)
+{
+       unsigned long *addr = vaddr;
+       unsigned long *p = addr + (offset >> 5);
+       int set = 0, bit = offset & 31, res;
+
+       if (bit) {
+               /* Look for zero in first longword */
+               __asm__("bfffo %1{#0,#0},%0"
+                       : "=d" (set)
+                       : "d" (~*p << bit));
+               if (set < (32 - bit))
+                       return set + offset;
+                set = 32 - bit;
+               p++;
+       }
+       /* No zero yet, search remaining full bytes for a zero */
+       res = find_first_zero_bit (p, size - 32 * (p - addr));
+       return (offset + set + res);
+}
+
+/*
+ * ffz = Find First Zero in word. Undefined if no zero exists,
+ * so code should check against ~0UL first..
+ */
+extern inline unsigned long ffz(unsigned long word)
+{
+       __asm__ __volatile__ ("bfffo %1{#0,#0},%0"
+                             : "=d" (word)
+                             : "d" (~(word)));
+       return word;
+}
+
+#endif /* _M68K_BITOPS_H */
diff --git a/include/asm-m68k/delay.h b/include/asm-m68k/delay.h
new file mode 100644 (file)
index 0000000..804a654
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef _M68K_DELAY_H
+#define _M68K_DELAY_H
+
+/*
+ * Copyright (C) 1994 Hamish Macdonald
+ *
+ * Delay routines, using a pre-computed "loops_per_second" value.
+ */
+
+extern __inline__ void __delay(int loops)
+{
+       __asm__("\n\tmovel %0,d0\n1:\tsubql #1,d0\n\tbpls 1b\n"
+               : /* no outputs */
+               : "g" (loops)
+               : "d0");
+}
+
+/*
+ * division by multiplication: you don't have to worry about
+ * loss of precision.
+ *
+ * Use only for very small delays ( < 1 msec).  Should probably use a
+ * lookup table, really, as the multiplications take much too long with
+ * short delays.  This is a "reasonable" implementation, though (and the
+ * first constant multiplications gets optimized away if the delay is
+ * a constant)  
+ */
+extern __inline__ void udelay(unsigned long usecs)
+{
+       asm ("mulul %1,d0,%0\n\t"
+            "divul  %2,d0,%0"
+            : "=d" (usecs)
+            : "d" (usecs),
+              "i" (1000000),
+              "0" (loops_per_sec)
+            : "d0");
+       __delay(usecs);
+}
+
+#endif /* defined(_M68K_DELAY_H) */
diff --git a/include/asm-m68k/dma.h b/include/asm-m68k/dma.h
new file mode 100644 (file)
index 0000000..2820f20
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef _M68K_DMA_H
+#define _M68K_DMA_H 1
+
+/* dummy for m68k */
+
+#endif /* _M68K_DMA_H */
diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h
new file mode 100644 (file)
index 0000000..0cde22f
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef _M68K_IO_H
+#define _M68K_IO_H
+
+static inline unsigned char get_user_byte_io(const char * addr)
+{
+       register unsigned char _v;
+
+       __asm__ __volatile__ ("moveb %1,%0":"=r" (_v):"m" (*addr));
+       return _v;
+}
+#define inb_p(addr) get_user_byte_io((char *)(addr))
+#define inb(addr) get_user_byte_io((char *)(addr))
+
+static inline void put_user_byte_io(char val,char *addr)
+{
+       __asm__ __volatile__ ("moveb %0,%1"
+                             : /* no outputs */
+                             :"r" (val),"m" (*addr)
+                             : "memory");
+}
+#define outb_p(x,addr) put_user_byte_io((x),(char *)(addr))
+#define outb(x,addr) put_user_byte_io((x),(char *)(addr))
+
+#endif /* _M68K_IO_H */
diff --git a/include/asm-m68k/irq.h b/include/asm-m68k/irq.h
new file mode 100644 (file)
index 0000000..c8f300c
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef _M68K_IRQ_H_
+#define _M68K_IRQ_H_
+
+/* dummy for m68k */
+
+#endif /* _M68K_IRQ_H_ */
diff --git a/include/asm-m68k/segment.h b/include/asm-m68k/segment.h
new file mode 100644 (file)
index 0000000..89079be
--- /dev/null
@@ -0,0 +1,241 @@
+/*
+ *  linux/include/asm-m68k/segment.h
+ *
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file README.legal in the main directory of this archive
+ * for more details.
+ */
+
+/*
+ * 680x0 support added by Hamish Macdonald
+ */
+
+#ifndef _M68K_SEGMENT_H
+#define _M68K_SEGMENT_H
+
+static inline unsigned char get_user_byte(const char * addr)
+{
+       register unsigned char _v;
+
+       __asm__ __volatile__ ("movesb %1,%0":"=r" (_v):"m" (*addr));
+       return _v;
+}
+
+#define get_fs_byte(addr) get_user_byte((char *)(addr))
+
+static inline unsigned short get_user_word(const short *addr)
+{
+       unsigned short _v;
+
+       __asm__ __volatile__ ("movesw %1,%0":"=r" (_v):"m" (*addr));
+       return _v;
+}
+
+#define get_fs_word(addr) get_user_word((short *)(addr))
+
+static inline unsigned long get_user_long(const int *addr)
+{
+       unsigned long _v;
+
+       __asm__ __volatile__ ("movesl %1,%0":"=r" (_v):"m" (*addr)); \
+       return _v;
+}
+
+#define get_fs_long(addr) get_user_long((int *)(addr))
+
+static inline void put_user_byte(char val,char *addr)
+{
+       __asm__ __volatile__ ("movesb %0,%1": /* no outputs */ :"r" (val),"m" (*addr) : "memory");
+}
+
+#define put_fs_byte(x,addr) put_user_byte((x),(char *)(addr))
+
+static inline void put_user_word(short val,short * addr)
+{
+       __asm__ __volatile__ ("movesw %0,%1": /* no outputs */ :"r" (val),"m" (*addr) : "memory");
+}
+
+#define put_fs_word(x,addr) put_user_word((x),(short *)(addr))
+
+static inline void put_user_long(unsigned long val,int * addr)
+{
+       __asm__ __volatile__ ("movesl %0,%1": /* no outputs */ :"r" (val),"m" (*addr) : "memory");
+}
+
+#define put_fs_long(x,addr) put_user_long((x),(int *)(addr))
+
+static inline void __generic_memcpy_tofs(void * to, const void * from, unsigned long n)
+{
+       if (n == 0) return;
+       __asm__ __volatile__ ("1:\n\t"
+                             "moveb %1@+,d0\n\t"
+                             "movesb d0,%2@+\n\t"
+                             "dbra %0,1b\n\t"
+                             "clrw %0\n\t"
+                             "subql #1,%0\n\t"
+                             "bccs 1b"
+                             : "=d" (n), "=a" (from), "=a" (to)
+                             : "1" (from), "2" (to), "0" (n-1)
+                             : "d0", "memory");
+}
+
+static inline void __constant_memcpy_tofs(void * to, const void * from, unsigned long n)
+{
+       if (n == 0) {
+                       return;
+       } else if (n == 1) {
+                       put_user_byte(*(const char *) from, (char *) to);
+                       return;
+       } else if (n == 2) {
+                       put_user_word(*(const short *) from, (short *) to);
+                       return;
+       } else if (n == 3) {
+                       put_user_word(*(const short *) from, (short *) to);
+                       put_user_byte(*(2+(const char *) from), 2+(char *) to);
+                       return;
+       } else if (n == 4) {
+                       put_user_long(*(const int *) from, (int *) to);
+                       return;
+       }
+#if 0
+#define COMMON(x) \
+__asm__("cld\n\t" \
+       "push %%es\n\t" \
+       "push %%fs\n\t" \
+       "pop %%es\n\t" \
+       "rep ; movsl\n\t" \
+       x \
+       "pop %%es" \
+       : /* no outputs */ \
+       :"c" (n/4),"D" ((long) to),"S" ((long) from) \
+       :"cx","di","si")
+
+       switch (n % 4) {
+               case 0:
+                       COMMON("");
+                       return;
+               case 1:
+                       COMMON("movsb\n\t");
+                       return;
+               case 2:
+                       COMMON("movsw\n\t");
+                       return;
+               case 3:
+                       COMMON("movsw\n\tmovsb\n\t");
+                       return;
+       }
+#undef COMMON
+#else
+        __generic_memcpy_tofs(to,from,n);
+#endif
+}
+
+static inline void __generic_memcpy_fromfs(void * to, const void * from, unsigned long n)
+{
+       if (n == 0) return;
+       __asm__ __volatile__ ("1:\n\t"
+                             "movesb %1@+,d0\n\t"
+                             "moveb d0,%2@+\n\t"
+                             "dbra %0,1b\n\t"
+                             "clrw %0\n\t"
+                             "subql #1,%0\n\t"
+                             "bccs 1b"
+                             : "=d" (n), "=a" (from), "=a" (to)
+                             : "1" (from), "2" (to), "0" (n-1)
+                             : "d0", "memory");
+}
+
+static inline void __constant_memcpy_fromfs(void * to, const void * from, unsigned long n)
+{
+       if (n == 0) {
+                       return;
+       } else if (n == 1) {
+                       *(char *)to = get_user_byte((const char *) from);
+                       return;
+       } else if (n == 2) {
+                       *(short *)to = get_user_word((const short *) from);
+                       return;
+       } else if (n == 3) {
+                       *(short *) to = get_user_word((const short *) from);
+                       *(2+(char *) to) = get_user_byte(2+(const char *) from);
+                       return;
+       } else if (n == 4) {
+                       *(int *) to = get_user_long((const int *) from);
+                       return;
+       }
+#if 0
+#define COMMON(x) \
+__asm__("cld\n\t" \
+       "rep ; fs ; movsl\n\t" \
+       x \
+       : /* no outputs */ \
+       :"c" (n/4),"D" ((long) to),"S" ((long) from) \
+       :"cx","di","si","memory")
+
+       switch (n % 4) {
+               case 0:
+                       COMMON("");
+                       return;
+               case 1:
+                       COMMON("fs ; movsb");
+                       return;
+               case 2:
+                       COMMON("fs ; movsw");
+                       return;
+               case 3:
+                       COMMON("fs ; movsw\n\tfs ; movsb");
+                       return;
+       }
+#undef COMMON
+#else
+        __generic_memcpy_fromfs(to,from,n);
+#endif
+}
+
+#define memcpy_fromfs(to, from, n) \
+(__builtin_constant_p(n) ? \
+ __constant_memcpy_fromfs((to),(from),(n)) : \
+ __generic_memcpy_fromfs((to),(from),(n)))
+
+#define memcpy_tofs(to, from, n) \
+(__builtin_constant_p(n) ? \
+ __constant_memcpy_tofs((to),(from),(n)) : \
+ __generic_memcpy_tofs((to),(from),(n)))
+
+/*
+ * Get/set the SFC/DFC registers for MOVES instructions
+ */
+
+static inline unsigned long get_fs(void)
+{
+       unsigned long _v;
+       __asm__ ("movec dfc,%0":"=r" (_v):);
+
+       return _v;
+}
+
+static inline unsigned long get_ds(void)
+{
+    /* return the supervisor data space code */
+    return 0x5;
+}
+
+static inline void set_fs(unsigned long val)
+{
+       __asm__ __volatile__ ("movec %0,sfc\n\t"
+                             "movec %0,dfc\n\t"
+                             : /* no outputs */ : "r" (val), "r" (val) : "memory");
+}
+
+/* define constants */
+/* Address spaces (FC0-FC2) */
+#ifndef USER_DS
+#define USER_DS       (1)
+#endif
+#ifndef KERNEL_DS
+#define KERNEL_DS     (5)
+#endif
+
+#endif /* _M68K_SEGMENT_H */
diff --git a/include/asm-m68k/string.h b/include/asm-m68k/string.h
new file mode 100644 (file)
index 0000000..4226ca9
--- /dev/null
@@ -0,0 +1,154 @@
+#ifndef _M68K_STRING_H_
+#define _M68K_STRING_H_
+
+#define __USE_PORTABLE_STRINGS_H_
+
+extern inline char * strcpy(char * dest,const char *src)
+{
+  char *xdest = dest;
+
+  __asm__ __volatile__
+       ("1:\tmoveb %1@+,%0@+\n\t"
+        "bne 1b"
+       : "=a" (dest), "=a" (src)
+        : "0" (dest), "1" (src) : "memory");
+  return xdest;
+}
+
+extern inline void * strncpy(char *dest, const void *src, size_t n)
+{
+  char *xdest = dest;
+
+  if (n == 0)
+    return xdest;
+
+  __asm__
+       ("1:\tmoveb %1@+,%0@+\n\t"
+       "beq 2f\n\t"
+        "subql #1,%3\n\t"
+        "bne 1b\n\t"
+        "2:"
+        : "=a" (dest), "=a" (src), "=d" (n)
+        : "0" (dest), "1" (src), "2" (n)
+        : "memory");
+return dest;
+}
+
+#define __USE_PORTABLE_strcat
+
+#define __USE_PORTABLE_strncat
+
+extern inline int strcmp(const char * cs,const char * ct)
+{
+  char __res;
+
+  __asm__
+       ("1:\tmoveb %0@+,%2\n\t" /* get *cs */
+        "cmpb %1@+,%2\n\t"      /* compare a byte */
+        "bne  2f\n\t"           /* not equal, break out */
+        "tstb %2\n\t"           /* at end of cs? */
+        "bne  1b\n\t"           /* no, keep going */
+        "bra  3f\n\t"          /* strings are equal */
+        "2:\tsubb %1@-,%2\n\t"  /* *cs - *ct */
+        "3:"
+        : "=a" (cs), "=a" (ct), "=d" (__res)
+        : "0" (cs), "1" (ct));
+  return __res;
+}
+
+extern inline int strncmp(const char * cs,const char * ct,size_t count)
+{
+  char __res;
+
+  if (!count)
+    return 0;
+  __asm__
+       ("1:\tmovb %0@+,%3\n\t"          /* get *cs */
+        "cmpb   %1@+,%3\n\t"            /* compare a byte */
+        "bne    3f\n\t"                 /* not equal, break out */
+        "tstb   %3\n\t"                 /* at end of cs? */
+        "beq    4f\n\t"                 /* yes, all done */
+        "subql  #1,%2\n\t"              /* no, adjust count */
+        "bne    1b\n\t"                 /* more to do, keep going */
+        "2:\tmoveq #0,%3\n\t"           /* strings are equal */
+        "bra    4f\n\t"
+        "3:\tsubb %1@-,%3\n\t"          /* *cs - *ct */
+        "4:"
+        : "=a" (cs), "=a" (ct), "=d" (count), "=d" (__res)
+        : "0" (cs), "1" (ct), "2" (count));
+  return __res;
+}
+
+#define __USE_PORTABLE_strchr
+
+#define __USE_PORTABLE_strlen
+
+#define __USE_PORTABLE_strspn
+
+#define __USE_PORTABLE_strpbrk
+
+#define __USE_PORTABLE_strtok
+
+extern inline void * memset(void * s,char c,size_t count)
+{
+  void *xs = s;
+
+  if (!count)
+    return xs;
+  __asm__ __volatile__
+       ("1:\tmoveb %3,%0@+\n\t"
+       "subql #1,%1\n\t"
+        "bne 1b"
+       : "=a" (s), "=d" (count)
+        : "0" (s), "d" (c), "1" (count)
+       : "memory");
+  return xs;
+}
+
+extern inline void * memcpy(void * to, const void * from, size_t n)
+{
+  void *xto = to;
+
+  if (!n)
+    return xto;
+  __asm__ __volatile__
+       ("1:\tmoveb %1@+,%0@+\n\t"
+       "subql #1,%2\n\t"
+        "bne 1b"
+        : "=a" (to), "=a" (from), "=d" (n)
+        : "0" (to), "1" (from), "2" (n)
+        : "memory" );
+  return xto;
+}
+
+extern inline void * memmove(void * dest,const void * src, size_t n)
+{
+  void *xdest = dest;
+
+  if (!n)
+    return xdest;
+
+  if (dest < src)
+    __asm__ __volatile__
+       ("1:\tmoveb %1@+,%0@+\n\t"
+       "subql #1,%2\n\t"
+        "bne 1b"
+        : "=a" (dest), "=a" (src), "=d" (n)
+        : "0" (dest), "1" (src), "2" (n)
+        : "memory" );
+  else
+    __asm__ __volatile__
+       ("1:\tmoveb %1@-,%0@-\n\t"
+       "subql #1,%2\n\t"
+        "bne 1b"
+        : "=a" (dest), "=a" (src), "=d" (n)
+        : "0" (dest+n), "1" (src+n), "2" (n)
+        : "memory" );
+  return xdest;
+}
+
+#define __USE_PORTABLE_memcmp
+
+#define __USE_PORTABLE_memscan
+
+#endif /* _M68K_STRING_H_ */
diff --git a/include/asm-m68k/system.h b/include/asm-m68k/system.h
new file mode 100644 (file)
index 0000000..e12764f
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ *  linux/include/asm-m68k/system.h
+ *
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file README.legal in the main directory of this archive
+ * for more details.
+ */
+
+/*
+ * 680x0 support added by Hamish Macdonald
+ */
+
+#ifndef _M68K_SYSTEM_H
+#define _M68K_SYSTEM_H
+
+#include <linux/autoconf.h> /* get configuration makros */
+
+#if defined(CONFIG_ATARI) && !defined(CONFIG_AMIGA) && !defined(CONFIG_MAC)
+/* block out HSYNC on the atari */
+#define sti() __asm__ __volatile__ ("andiw #0xfbff,sr": : : "memory")
+#else /* portable version */
+#define sti() __asm__ __volatile__ ("andiw #0xf8ff,sr": : : "memory")
+#endif /* machine compilation types */ 
+#define cli() __asm__ __volatile__ ("oriw  #0x0700,sr": : : "memory")
+#define nop() __asm__ __volatile__ ("nop"::)
+
+#define save_flags(x) \
+__asm__ __volatile__("movew sr,%0":"=d" (x) : /* no input */ :"memory")
+
+#define restore_flags(x) \
+__asm__ __volatile__("movew %0,sr": /* no outputs */ :"d" (x) : "memory")
+
+#define iret() __asm__ __volatile__ ("rte": : :"memory", "sp", "cc")
+
+#define move_to_user_mode() \
+    __asm__ __volatile__ ("movel sp,usp\n\t"     /* setup user sp       */ \
+                         "movec %0,msp\n\t"     /* setup kernel sp     */ \
+                         "andiw #0xdfff,sr"     /* return to user mode */ \
+                         : /* no output */                                \
+                         : "r" (current->kernel_stack_page + PAGE_SIZE)   \
+                         : "memory", "sp")
+
+static inline void clear_fpu(void) {
+       unsigned long nilstate = 0;
+       __asm__ __volatile__ ("frestore %0@" : : "a" (&nilstate));
+}
+
+#define halt() \
+        __asm__ __volatile__ ("halt")
+
+#endif /* _M68K_SYSTEM_H */
diff --git a/include/asm-m68k/unistd.h b/include/asm-m68k/unistd.h
new file mode 100644 (file)
index 0000000..acad643
--- /dev/null
@@ -0,0 +1,114 @@
+#ifndef _ASM_M68K_UNISTD_H_
+#define _ASM_M68K_UNISTD_H_
+
+/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
+#define _syscall0(type,name) \
+type name(void) \
+{ \
+register long __res __asm__ ("d0") = __NR_##name; \
+__asm__ __volatile__ ("trap  #0" \
+                      : "=g" (__res) \
+                      : "0" (__NR_##name) \
+                     : "d0"); \
+if (__res >= 0) \
+        return (type) __res; \
+errno = -__res; \
+return -1; \
+}
+
+#define _syscall1(type,name,atype,a) \
+type name(atype a) \
+{ \
+register long __res __asm__ ("d0") = __NR_##name; \
+__asm__ __volatile__ ("movel %2,d1\n\t" \
+                      "trap  #0" \
+                      : "=g" (__res) \
+                      : "0" (__NR_##name), "g" ((long)(a)) \
+                      : "d0", "d1"); \
+if (__res >= 0) \
+        return (type) __res; \
+errno = -__res; \
+return -1; \
+}
+
+#define _syscall2(type,name,atype,a,btype,b) \
+type name(atype a,btype b) \
+{ \
+register long __res __asm__ ("d0") = __NR_##name; \
+__asm__ __volatile__ ("movel %2,d1\n\t" \
+                      "movel %3,d2\n\t" \
+                      "trap  #0" \
+                      : "=g" (__res) \
+                      : "0" (__NR_##name), "g" ((long)(a)), \
+                                          "g" ((long)(b)) \
+                      : "d0", "d1", "d2"); \
+if (__res >= 0) \
+        return (type) __res; \
+errno = -__res; \
+return -1; \
+}
+
+#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
+type name(atype a,btype b,ctype c) \
+{ \
+register long __res __asm__ ("d0") = __NR_##name; \
+__asm__ __volatile__ ("movel %2,d1\n\t" \
+                      "movel %3,d2\n\t" \
+                      "movel %4,d3\n\t" \
+                      "trap  #0" \
+                      : "=g" (__res) \
+                      : "0" (__NR_##name), "g" ((long)(a)), \
+                                          "g" ((long)(b)), \
+                                          "g" ((long)(c)) \
+                      : "d0", "d1", "d2", "d3"); \
+if (__res >= 0) \
+        return (type) __res; \
+errno = -__res; \
+return -1; \
+}
+
+#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
+type name (atype a, btype b, ctype c, dtype d) \
+{ \
+register long __res __asm__ ("d0") = __NR_##name; \
+__asm__ __volatile__ ("movel %2,d1\n\t" \
+                      "movel %3,d2\n\t" \
+                      "movel %4,d3\n\t" \
+                      "movel %5,d4\n\t" \
+                      "trap  #0" \
+                      : "=g" (__res) \
+                      : "0" (__NR_##name), "g" ((long)(a)), \
+                                          "g" ((long)(b)), \
+                                          "g" ((long)(c)), \
+                                          "g" ((long)(d))  \
+                      : "d0", "d1", "d2", "d3", "d4"); \
+if (__res >= 0) \
+        return (type) __res; \
+errno = -__res; \
+return -1; \
+}
+
+#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
+type name (atype a,btype b,ctype c,dtype d,etype e) \
+{ \
+register long __res __asm__ ("d0") = __NR_##name; \
+__asm__ __volatile__ ("movel %2,d1\n\t" \
+                      "movel %3,d2\n\t" \
+                      "movel %4,d3\n\t" \
+                      "movel %5,d4\n\t" \
+                      "movel %6,d5\n\t" \
+                      "trap  #0" \
+                      : "=g" (__res) \
+                      : "0" (__NR_##name), "g" ((long)(a)), \
+                                          "g" ((long)(b)), \
+                                          "g" ((long)(c)), \
+                                          "g" ((long)(d)), \
+                                          "g" ((long)(e))  \
+                      : "d0", "d1", "d2", "d3", "d4", "d5"); \
+if (__res >= 0) \
+        return (type) __res; \
+errno = -__res; \
+return -1; \
+}
+
+#endif /* _ASM_M68K_UNISTD_H_ */
index cc47c39bd8544b3d74fbe2d65281677e81b3b9fd..7e4912304cf9f073dfcfba83e2e308c78395a995 100644 (file)
@@ -1,5 +1,11 @@
-#ifndef _ELF_H
-#define _ELF_H
+#ifndef _LINUX_ELF_H
+#define _LINUX_ELF_H
+
+typedef unsigned long  Elf32_Addr;
+typedef unsigned short Elf32_Half;
+typedef unsigned long  Elf32_Off;
+typedef long           Elf32_Sword;
+typedef unsigned long  Elf32_Word;
 
 /* These constants are for the segment types stored in the image headers */
 #define PT_NULL    0
 
 
 typedef struct dynamic{
-  int d_tag;
+  Elf32_Sword d_tag;
   union{
-    int d_val;
-    char * d_ptr;
+    Elf32_Sword        d_val;
+    Elf32_Addr d_ptr;
   } d_un;
 } Elf32_Dyn;
 
+extern Elf32_Dyn _DYNAMIC [];
+
 /* The following are used with relocations */
 #define ELF32_R_SYM(x) ((x) >> 8)
 #define ELF32_R_TYPE(x) ((x) & 0xff)
@@ -101,53 +109,103 @@ typedef struct dynamic{
 #define R_386_NUM      11
 
 typedef struct elf32_rel {
-  unsigned int * offset;
-  int info;
+  Elf32_Addr   r_offset;
+  Elf32_Word   r_info;
 } Elf32_Rel;
 
 typedef struct elf32_rela{
-  unsigned int * offset;
-  int info;
-  int addend;
+  Elf32_Addr   r_offset;
+  Elf32_Word   r_info;
+  Elf32_Sword  r_addend;
 } Elf32_Rela;
 
 typedef struct elf32_sym{
-  int st_name;
-  unsigned int st_value;
-  int st_size;
-  unsigned char st_info;
-  unsigned char st_other;
-  short int st_shndx;
+  Elf32_Word   st_name;
+  Elf32_Addr   st_value;
+  Elf32_Word   st_size;
+  unsigned char        st_info;
+  unsigned char        st_other;
+  Elf32_Half   st_shndx;
 } Elf32_Sym;
 
+
+#define EI_NIDENT      16
+
 typedef struct elfhdr{
-  char e_ident[16];
-  short int e_type;
-  short int e_machine;
-  int   e_version;
-  char *e_entry;  /* Entry point */
-  int   e_phoff;
-  int   e_shoff;
-  int   e_flags;
-  short int e_ehsize;
-  short int e_phentsize;
-  short int e_phnum;
-  short int e_shentsize;
-  short int e_shnum;
-  short int e_shstrndx;
+  unsigned char        e_ident[EI_NIDENT];
+  Elf32_Half   e_type;
+  Elf32_Half   e_machine;
+  Elf32_Word   e_version;
+  Elf32_Addr   e_entry;  /* Entry point */
+  Elf32_Off    e_phoff;
+  Elf32_Off    e_shoff;
+  Elf32_Word   e_flags;
+  Elf32_Half   e_ehsize;
+  Elf32_Half   e_phentsize;
+  Elf32_Half   e_phnum;
+  Elf32_Half   e_shentsize;
+  Elf32_Half   e_shnum;
+  Elf32_Half   e_shstrndx;
 } Elf32_Ehdr;
 
 typedef struct elf_phdr{
-  int p_type;
-  int p_offset;
-  int p_vaddr;
-  int p_paddr;
-  int p_filesz;
-  int p_memsz;
-  int p_flags;
-  int p_align;
+  Elf32_Word   p_type;
+  Elf32_Off    p_offset;
+  Elf32_Addr   p_vaddr;
+  Elf32_Addr   p_paddr;
+  Elf32_Word   p_filesz;
+  Elf32_Word   p_memsz;
+  Elf32_Word   p_flags;
+  Elf32_Word   p_align;
 } Elf32_Phdr;
 
+/* sh_type */
+#define SHT_NULL       0
+#define SHT_PROGBITS   1
+#define SHT_SYMTAB     2
+#define SHT_STRTAB     3
+#define SHT_RELA       4
+#define SHT_HASH       5
+#define SHT_DYNAMIC    6
+#define SHT_NOTE       7
+#define SHT_NOBITS     8
+#define SHT_REL                9
+#define SHT_SHLIB      10
+#define SHT_DYNSYM     11
+#define SHT_NUM                12
+#define SHT_LOPROC     0x70000000
+#define SHT_HIPROC     0x7fffffff
+#define SHT_LOUSER     0x80000000
+#define SHT_HIUSER     0xffffffff
+
+/* sh_flags */
+#define SHF_WRITE      0x1
+#define SHF_ALLOC      0x2
+#define SHF_EXECINSTR  0x4
+#define SHF_MASKPROC   0xf0000000
+
+/* special section indexes */
+#define SHN_UNDEF      0
+#define SHN_LORESERVE  0xff00
+#define SHN_LOPROC     0xff00
+#define SHN_HIPROC     0xff1f
+#define SHN_ABS                0xfff1
+#define SHN_COMMON     0xfff2
+#define SHN_HIRESERVE  0xffff
+typedef struct {
+  Elf32_Word   sh_name;
+  Elf32_Word   sh_type;
+  Elf32_Word   sh_flags;
+  Elf32_Addr   sh_addr;
+  Elf32_Off    sh_offset;
+  Elf32_Word   sh_size;
+  Elf32_Word   sh_link;
+  Elf32_Word   sh_info;
+  Elf32_Word   sh_addralign;
+  Elf32_Word   sh_entsize;
+} Elf32_Shdr;
+
 #define ELF_START_MMAP 0x80000000
 
-#endif
+#endif /* _LINUX_ELF_H */
index 9b112ab806d2f78e2d37a90fd5ac30d83c91a80f..7ab58662dd680b5bf2ad1bed9b14b0e638c1a6ad 100644 (file)
 
 #define PCI_VENDOR_ID_NCR              0x1000
 #define PCI_DEVICE_ID_NCR_53C810       0x0001
+#define PCI_DEVICE_ID_NCR_53C815       0x0004
 #define PCI_DEVICE_ID_NCR_53C820       0x0002
 #define PCI_DEVICE_ID_NCR_53C825       0x0003
 
index fe40f4b4e4bd5b26ecfc70f70d8137adc813b091..5260a3b0fa4067f6f02319214c670c14d89440c7 100644 (file)
@@ -12,6 +12,7 @@ enum root_directory_inos {
        PROC_MEMINFO,
        PROC_KMSG,
        PROC_VERSION,
+       PROC_CPUINFO,
        PROC_SELF,      /* will change inode # */
        PROC_NET,
 #ifdef CONFIG_DEBUG_MALLOC
index 3a38d57eb6f7ee18e6c35f3ff9f30b76d862981c..440cae6bef4cb4bab364e2179d4253c6aabecee8 100644 (file)
@@ -16,6 +16,8 @@
  */
 extern int hard_math;
 extern int x86;
+extern char x86_vendor_id[13];
+extern fdiv_bug;               
 extern int ignore_irq13;
 extern int wp_works_ok;                /* doesn't work on a 386 */
 extern int hlt_works_ok;       /* problems on some 486Dx4's and old 386's */
index ceaabb60ff9b8dc801e16a833a014e4c6de51caa..649900e48fecf499fbd424f57e16b5e3f4f93a37 100644 (file)
@@ -414,7 +414,7 @@ static void check_fpu(void)
        static double x = 4195835.0;
        static double y = 3145727.0;
        unsigned short control_word;
-       int i;
+       extern int fdiv_bug;
 
        if (!hard_math) {
 #ifndef CONFIG_MATH_EMULATION
@@ -458,9 +458,9 @@ static void check_fpu(void)
                "fistpl %0\n\t"
                "fwait\n\t"
                "fninit"
-               : "=m" (*&i)
+               : "=m" (*&fdiv_bug)
                : "m" (*&x), "m" (*&y));
-       if (!i) {
+       if (!fdiv_bug) {
                printk("Ok, fpu using exception 16 error reporting.\n");
                return;
 
index e81faff1a9d9410aa85319194f50f7b95a6ce083..0ed9cda2dd339d2d08bbd7c6573785619f00a9e1 100644 (file)
@@ -193,7 +193,7 @@ int pcibios_present(void)
        return pcibios_entry ? 1 : 0;
 }
 
-int pcibios_find_class_code (unsigned long class_code, unsigned short index,
+int pcibios_find_class (unsigned long class_code, unsigned short index,
        unsigned char *bus, unsigned char *device_fn)
 {
        unsigned long bx;
index 22a748eaefa243088b2dd3f7ebba53d537a628d0..da73dc0e0caa5902bc04d461cafb330e556dedc3 100644 (file)
 #include <linux/netdevice.h>
 #endif
 #ifdef CONFIG_PCI
-#include <pci.h>
+#include <linux/pci.h>
+#endif
+#if defined(CONFIG_MSDOS_FS) && !defined(CONFIG_UMSDOS_FS)
+#include <linux/msdos_fs.h>
 #endif
 
 #include <asm/irq.h>
@@ -265,6 +268,30 @@ struct symbol_table symbol_table = { 0, 0, 0, /* for stacked module support */
        X(chrdev_inode_operations),
        X(blkdev_inode_operations),
        X(read_ahead),
+       X(get_hash_table),
+       X(get_empty_inode),
+       X(insert_inode_hash),
+#if defined(CONFIG_MSDOS_FS) && !defined(CONFIG_UMSDOS_FS)
+       /* support for umsdos fs */
+       X(msdos_create),
+       X(msdos_file_read),
+       X(msdos_file_write),
+       X(msdos_lookup),
+       X(msdos_mkdir),
+       X(msdos_put_inode),
+       X(msdos_put_super),
+       X(msdos_read_inode),
+       X(msdos_read_super),
+       X(msdos_readdir),
+       X(msdos_rename),
+       X(msdos_rmdir),
+       X(msdos_smap),
+       X(msdos_statfs),
+       X(msdos_truncate),
+       X(msdos_unlink),
+       X(msdos_unlink_umsdos),
+       X(msdos_write_inode),
+#endif
        /********************************************************
         * Do not add anything below this line,
         * as the stacked modules depend on this!
index d92269b3024da7d39c46d01a4d5873a1a395647b..f700d645ee643ad77ca864fd83f7ce5ab6b75a70 100644 (file)
@@ -173,8 +173,10 @@ asmlinkage int printk(const char *fmt, ...)
                        log_buf[(log_start+log_size) & (LOG_BUF_LEN-1)] = *p;
                        if (log_size < LOG_BUF_LEN)
                                log_size++;
-                       else
+                       else {
                                log_start++;
+                               log_start &= LOG_BUF_LEN-1;
+                       }
                        logged_chars++;
                        if (*p == '\n')
                                break;
index 6eed6e8f50f685f1296b86b0c40c91498fe47060..328fb0aacff7e19269517261aa663343ae8035e2 100644 (file)
@@ -70,6 +70,10 @@ unsigned long event = 0;
  */
 int hard_math = 0;             /* set by boot/head.S */
 int x86 = 0;                   /* set by boot/head.S to 3 or 4 */
+int fdiv_bug = 0;              /* set if Pentium(TM) with FP bug */
+
+char x86_vendor_id[13] = "Unknown";
+
 int ignore_irq13 = 0;          /* set if exception 16 works */
 int wp_works_ok = 0;           /* set if paging hardware honours WP */ 
 int hlt_works_ok = 1;          /* set if the "hlt" instruction works */
index e290a36543a8692f54515f2f586d804757df4c98..fde486d06d1cca63a3eda4edf6fe2a65d0561c4b 100644 (file)
@@ -198,22 +198,23 @@ static inline unsigned long do_gettimeoffset(void)
 /*
  * This version of gettimeofday has near microsecond resolution.
  */
-static inline void do_gettimeofday(struct timeval *tv)
+void do_gettimeofday(struct timeval *tv)
 {
-#ifdef __i386__
+       unsigned long flags;
+
+       save_flags(flags);
        cli();
+#ifdef __i386__
        *tv = xtime;
        tv->tv_usec += do_gettimeoffset();
        if (tv->tv_usec >= 1000000) {
                tv->tv_usec -= 1000000;
                tv->tv_sec++;
        }
-       sti();
 #else /* not __i386__ */
-       cli();
        *tv = xtime;
-       sti();
 #endif /* not __i386__ */
+       restore_flags(flags);
 }
 
 asmlinkage int sys_gettimeofday(struct timeval *tv, struct timezone *tz)
index d52621330ab11c75c2d00660c3214c6fc5addb3d..b85d81ea057d18b4df207ae9720138ca1979efc4 100644 (file)
@@ -58,6 +58,7 @@ unsigned long high_memory = 0;
 
 extern unsigned long pg0[1024];                /* page table for 0-4MB for everybody */
 
+extern void scsi_mem_init(unsigned long);
 extern void sound_mem_init(void);
 extern void die_if_kernel(char *,struct pt_regs *,long);
 extern void show_net_buffers(void);
@@ -1197,7 +1198,6 @@ void mem_init(unsigned long start_low_mem,
        unsigned long tmp;
        extern int etext;
 
-       cli();
        end_mem &= PAGE_MASK;
        high_memory = end_mem;
 
@@ -1219,6 +1219,9 @@ void mem_init(unsigned long start_low_mem,
                mem_map[MAP_NR(start_mem)] = 0;
                start_mem += PAGE_SIZE;
        }
+#ifdef CONFIG_SCSI
+       scsi_mem_init(high_memory);
+#endif
 #ifdef CONFIG_SOUND
        sound_mem_init();
 #endif
index f0aa485a5f69e95eb8884362a4661d9a042c7cb6..85213a05053978587fc124e1e39675de83623148 100644 (file)
@@ -371,6 +371,7 @@ void kfree_skb(struct sk_buff *skb, int rw)
                                skb->sk->wmem_alloc-=skb->mem_len;
                        if(!skb->sk->dead)
                                skb->sk->write_space(skb->sk);
+                       kfree_skbmem(skb,skb->mem_len);
                }
        }
        else
index ea92cc340e99f24a04fc720881c6158cbd06469c..4f6290c16a9754e45cd5296b02a3855de44eb471 100644 (file)
@@ -61,6 +61,7 @@
  *             Adam Caldwell   :       Missing return in SO_DONTROUTE/SO_DEBUG code
  *             Alan Cox        :       Split IP from generic code
  *             Alan Cox        :       New kfree_skbmem()
+ *             Alan Cox        :       Make SO_DEBUG superuser only.
  *
  * To Fix:
  *
@@ -133,6 +134,8 @@ int sock_setsockopt(struct sock *sk, int level, int optname,
                        return(-ENOPROTOOPT);
 
                case SO_DEBUG:  
+                       if(!suser())
+                               return(-EPERM);
                        sk->debug=val?1:0;
                        return 0;
                case SO_DONTROUTE:
index 02d20dda30873319d17d02f6586f5191839f8f04..0d2406e7bccca75615b2132ab74b9aa545f2c866 100644 (file)
@@ -275,30 +275,12 @@ static struct sk_buff *tcp_find_established(struct sock *s)
 
 static void tcp_close_pending (struct sock *sk, int timeout) 
 {
-       unsigned long flags;
-       struct sk_buff *p, *old_p;
-
-       save_flags(flags);
-       cli(); 
-       p=skb_peek(&sk->receive_queue);
-
-       if(p==NULL) 
-       {
-               restore_flags(flags);
-               return;
-       }
+       struct sk_buff *skb;
 
-       do
-       {
-               tcp_close (p->sk, timeout);
-               skb_unlink (p);
-               old_p = p;
-               p=p->next;
-               kfree_skb(old_p, FREE_READ);
+       while ((skb = skb_dequeue(&sk->receive_queue)) != NULL) {
+               tcp_close(skb->sk, timeout);
+               kfree_skb(skb, FREE_READ);
        }
-       while(p!=skb_peek(&sk->receive_queue));
-
-       restore_flags(flags);
        return;
 }
 
@@ -2355,8 +2337,8 @@ static void tcp_close(struct sock *sk, int timeout)
                case TCP_LISTEN:
                        /* we need to drop any sockets which have been connected,
                           but have not yet been accepted. */
-                       tcp_close_pending(sk, timeout);
                        tcp_set_state(sk,TCP_CLOSE);
+                       tcp_close_pending(sk, timeout);
                        release_sock(sk);
                        return;
                case TCP_CLOSE: