home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1996 May / PCOnline_05_1996.bin / linux / source / kernel-s / v1.3 / patch-1.012 / patch-1.3.12
Text File  |  1995-07-25  |  86KB  |  2,823 lines

  1. diff -u --recursive --new-file v1.3.11/linux/Makefile linux/Makefile
  2. --- v1.3.11/linux/Makefile    Tue Jul 18 16:28:55 1995
  3. +++ linux/Makefile    Thu Jul 20 09:22:10 1995
  4. @@ -1,6 +1,6 @@
  5.  VERSION = 1
  6.  PATCHLEVEL = 3
  7. -SUBLEVEL = 11
  8. +SUBLEVEL = 12
  9.  
  10.  ARCH = i386
  11.  
  12. @@ -239,10 +239,8 @@
  13.      rm -f .version .config* config.in config.old
  14.      rm -f include/asm
  15.      rm -f .depend `find . -name .depend -print`
  16. -ifdef CONFIG_MODVERSIONS
  17.      rm -f $(TOPDIR)/include/linux/modversions.h
  18.      rm -f $(TOPDIR)/include/linux/modules/*
  19. -endif
  20.  
  21.  distclean: mrproper
  22.      rm -f core `find . -name '*.orig' -print`
  23. diff -u --recursive --new-file v1.3.11/linux/arch/alpha/kernel/entry.S linux/arch/alpha/kernel/entry.S
  24. --- v1.3.11/linux/arch/alpha/kernel/entry.S    Tue Jul 18 16:28:56 1995
  25. +++ linux/arch/alpha/kernel/entry.S    Mon Jul 24 17:38:25 1995
  26. @@ -300,10 +300,13 @@
  27.  entUna:
  28.      lda $30,-256($30)
  29.      stq $0,0($30)
  30. +    ldq $0,256($30)        /* get PS */
  31.      stq $1,8($30)
  32.      stq $2,16($30)
  33.      stq $3,24($30)
  34. +    and $0,8,$0        /* user mode? */
  35.      stq $4,32($30)
  36. +    bne $0,entUnaUser    /* yup -> do user-level unaligned fault */
  37.      stq $5,40($30)
  38.      stq $6,48($30)
  39.      stq $7,56($30)
  40. @@ -363,6 +366,17 @@
  41.      lda $30,256($30)
  42.      rti
  43.  .end entUna
  44. +
  45. +.align 3
  46. +.ent    entUnaUser
  47. +entUnaUser:
  48. +    ldq $0,0($30)            /* restore original $0 */
  49. +    lda $30,256($30)        /* pop entUna's stack frame */
  50. +    SAVE_ALL            /* setup normal kernel stack */
  51. +    lda $27,do_entUnaUser
  52. +    lda $26,ret_from_sys_call
  53. +    jsr $31,($27),do_entUnaUser
  54. +.end    entUnaUser
  55.  
  56.  .align 3
  57.  .globl    sys_fork
  58. diff -u --recursive --new-file v1.3.11/linux/arch/alpha/kernel/osf_sys.c linux/arch/alpha/kernel/osf_sys.c
  59. --- v1.3.11/linux/arch/alpha/kernel/osf_sys.c    Tue Jun 27 14:11:30 1995
  60. +++ linux/arch/alpha/kernel/osf_sys.c    Tue Jul 25 10:39:23 1995
  61. @@ -153,26 +153,15 @@
  62.      return current->pid;
  63.  }
  64.  
  65. -#define OSF_MAP_ANONYMOUS    0x0010
  66. -#define OSF_MAP_FIXED        0x0100
  67. -#define OSF_MAP_HASSEMAPHORE    0x0200
  68. -#define OSF_MAP_INHERIT        0x0400
  69. -#define OSF_MAP_UNALIGNED    0x0800
  70. -
  71.  asmlinkage unsigned long osf_mmap(unsigned long addr, unsigned long len,
  72. -    unsigned long prot, unsigned long osf_flags, unsigned long fd,
  73. +    unsigned long prot, unsigned long flags, unsigned long fd,
  74.      unsigned long off)
  75.  {
  76.      struct file * file = NULL;
  77. -    unsigned long flags = osf_flags & 0x0f;
  78.  
  79. -    if (osf_flags & (OSF_MAP_HASSEMAPHORE | OSF_MAP_INHERIT | OSF_MAP_UNALIGNED))
  80. +    if (flags & (MAP_HASSEMAPHORE | MAP_INHERIT | MAP_UNALIGNED))
  81.          printk("%s: unimplemented OSF mmap flags %04lx\n", current->comm, osf_flags);
  82. -    if (osf_flags & OSF_MAP_FIXED)
  83. -        flags |= MAP_FIXED;
  84. -    if (osf_flags & OSF_MAP_ANONYMOUS)
  85. -        flags |= MAP_ANONYMOUS;
  86. -    else {
  87. +    if (!(flags & MAP_ANONYMOUS)) {
  88.          if (fd >= NR_OPEN || !(file = current->files->fd[fd]))
  89.              return -EBADF;
  90.      }
  91. diff -u --recursive --new-file v1.3.11/linux/arch/alpha/kernel/ptrace.c linux/arch/alpha/kernel/ptrace.c
  92. --- v1.3.11/linux/arch/alpha/kernel/ptrace.c    Tue Jul 18 16:28:56 1995
  93. +++ linux/arch/alpha/kernel/ptrace.c    Mon Jul 24 17:38:25 1995
  94. @@ -531,6 +531,12 @@
  95.      int i, nsaved = child->debugreg[4];
  96.  
  97.      child->debugreg[4] = 0;
  98. +
  99. +    if (nsaved > 2) {
  100. +        printk("ptrace_cancel_bpt: bogus nsaved: %d!\n", nsaved);
  101. +        nsaved = 2;
  102. +    }
  103. +
  104.      for (i = 0; i < nsaved; ++i) {
  105.          write_int(child, child->debugreg[i], child->debugreg[i + 2]);
  106.      }
  107. @@ -550,65 +556,65 @@
  108.      set_success(®s,0);
  109.      if (request == PTRACE_TRACEME) {
  110.          /* are we already being traced? */
  111. -       if (current->flags & PF_PTRACED) {
  112. -          set_failure(®s,-EPERM);
  113. -          return -EPERM;
  114. -       }
  115. -       /* set the ptrace bit in the process flags. */
  116. -       current->flags |= PF_PTRACED;
  117. -       return 0;
  118. -    }
  119. -    if (pid == 1) {
  120. -       set_failure(®s,-EPERM);
  121. -       return -EPERM;
  122. +        if (current->flags & PF_PTRACED) {
  123. +            set_failure(®s,-EPERM);
  124. +            return -EPERM;
  125. +        }
  126. +        /* set the ptrace bit in the process flags. */
  127. +        current->flags |= PF_PTRACED;
  128. +        return 0;
  129. +    }
  130. +    if (pid == 1) {        /* you may not mess with init */
  131. +        set_failure(®s,-EPERM);
  132. +        return -EPERM;
  133.      }
  134.      if (!(child = get_task(pid))) {
  135. -       set_failure(®s,-ESRCH);
  136. -       return -ESRCH;
  137. +        set_failure(®s,-ESRCH);
  138. +        return -ESRCH;
  139.      }
  140.      if (request == PTRACE_ATTACH) {
  141. -       if (child == current) {
  142. -          set_failure(®s,-EPERM);
  143. -          return -EPERM;
  144. -       }
  145. -       if ((!child->dumpable ||
  146. -        (current->uid != child->euid) ||
  147. -        (current->uid != child->uid) ||
  148. -        (current->gid != child->egid) ||
  149. -        (current->gid != child->gid)) && !suser()) {
  150. -          set_failure(®s,-EPERM);
  151. -          return -EPERM;
  152. -       }
  153. -       /* the same process cannot be attached many times */
  154. -       if (child->flags & PF_PTRACED) {
  155. -          set_failure(®s,-EPERM);
  156. -          return -EPERM;
  157. -       }
  158. -       child->flags |= PF_PTRACED;
  159. -       if (child->p_pptr != current) {
  160. -          REMOVE_LINKS(child);
  161. -          child->p_pptr = current;
  162. -          SET_LINKS(child);
  163. -       }
  164. -       send_sig(SIGSTOP, child, 1);
  165. -       return 0;
  166. +        if (child == current) {
  167. +            set_failure(®s,-EPERM);
  168. +            return -EPERM;
  169. +        }
  170. +        if ((!child->dumpable ||
  171. +             (current->uid != child->euid) ||
  172. +             (current->uid != child->uid) ||
  173. +             (current->gid != child->egid) ||
  174. +             (current->gid != child->gid)) && !suser()) {
  175. +            set_failure(®s,-EPERM);
  176. +            return -EPERM;
  177. +        }
  178. +        /* the same process cannot be attached many times */
  179. +        if (child->flags & PF_PTRACED) {
  180. +            set_failure(®s,-EPERM);
  181. +            return -EPERM;
  182. +        }
  183. +        child->flags |= PF_PTRACED;
  184. +        if (child->p_pptr != current) {
  185. +            REMOVE_LINKS(child);
  186. +            child->p_pptr = current;
  187. +            SET_LINKS(child);
  188. +        }
  189. +        send_sig(SIGSTOP, child, 1);
  190. +        return 0;
  191.      }
  192.      if (!(child->flags & PF_PTRACED)) {
  193. -        DBG(DBG_MEM, ("child not traced\n"));
  194. -        set_failure(®s,-ESRCH);
  195. -        return -ESRCH;
  196. +        DBG(DBG_MEM, ("child not traced\n"));
  197. +        set_failure(®s,-ESRCH);
  198. +        return -ESRCH;
  199.      }
  200.      if (child->state != TASK_STOPPED) {
  201. -       DBG(DBG_MEM, ("child process not stopped\n"));
  202. -       if (request != PTRACE_KILL) {
  203. -          set_failure(®s,-ESRCH);
  204. -          return -ESRCH;
  205. -       }
  206. +        DBG(DBG_MEM, ("child process not stopped\n"));
  207. +        if (request != PTRACE_KILL) {
  208. +            set_failure(®s,-ESRCH);
  209. +            return -ESRCH;
  210. +        }
  211.      }
  212.      if (child->p_pptr != current) {
  213. -       DBG(DBG_MEM, ("child not parent of this process\n"));
  214. -       set_failure(®s,-ESRCH);
  215. -       return -ESRCH;
  216. +        DBG(DBG_MEM, ("child not parent of this process\n"));
  217. +        set_failure(®s,-ESRCH);
  218. +        return -ESRCH;
  219.      }
  220.  
  221.      switch (request) {
  222. @@ -621,12 +627,11 @@
  223.              DBG(DBG_MEM, ("doing request at addr 0x%lx\n",addr));
  224.              res = read_long(child, addr, &tmp);
  225.              if (res < 0) {
  226. -               set_failure(®s,res);
  227. -               return res;
  228. -            }
  229. -            else {
  230. -               set_success(®s,tmp);
  231. -               return 0;
  232. +                set_failure(®s,res);
  233. +                return res;
  234. +            } else {
  235. +                set_success(®s,tmp);
  236. +                return 0;
  237.              }
  238.          }
  239.  
  240. @@ -636,21 +641,20 @@
  241.              unsigned long tmp;
  242.  
  243.              tmp = 0;  /* Default return condition */
  244. -            if(addr==30) {
  245. -               /* stack pointer */
  246. -               tmp=child->tss.usp;
  247. -            }
  248. -            else {
  249. +            if (addr == 30) {
  250. +                /* stack pointer */
  251. +                tmp=child->tss.usp;
  252. +            } else {
  253.  #ifdef DEBUG
  254. -               int reg=addr;
  255. +                int reg = addr;
  256.  #endif
  257. -               addr = offset_of_register(addr);
  258. -               if (addr < 0) {
  259. -                  set_failure(®s, -EIO);
  260. -                  return -EIO;
  261. -               }
  262. -               tmp = get_stack_long(child, addr);
  263. -               DBG(DBG_MEM, ("%d = reg 0x%lx=tmp\n",reg,tmp));
  264. +                addr = offset_of_register(addr);
  265. +                if (addr < 0) {
  266. +                    set_failure(®s, -EIO);
  267. +                    return -EIO;
  268. +                }
  269. +                tmp = get_stack_long(child, addr);
  270. +                DBG(DBG_MEM, ("%d = reg 0x%lx=tmp\n",reg,tmp));
  271.              }
  272.              set_success(®s,tmp);
  273.              return 0;
  274. @@ -659,34 +663,34 @@
  275.        /* when I and D space are separate, this will have to be fixed. */
  276.          case PTRACE_POKETEXT: /* write the word at location addr. */
  277.          case PTRACE_POKEDATA: {
  278. -            long res=write_long(child,addr,data);
  279. -            if(res) {
  280. -               set_failure(®s,res);
  281. +            long res = write_long(child,addr,data);
  282. +            if (res) {
  283. +                set_failure(®s,res);
  284.              }
  285.              return res;
  286.          }
  287.  
  288.          case PTRACE_POKEUSR: /* write the specified register */
  289. -        {
  290. -           long res;
  291. -           addr= offset_of_register(addr);
  292. -           if(addr < 0) {
  293. -              set_failure(®s,-EIO);
  294. -              return -EIO;
  295. -           }
  296. -           res=put_stack_long(child,addr,data);
  297. -           if(res) {
  298. -              set_failure(®s,res);
  299. -           }
  300. -           return res;
  301. -        }
  302. +          {
  303. +              long res;
  304. +              addr = offset_of_register(addr);
  305. +              if(addr < 0) {
  306. +                  set_failure(®s,-EIO);
  307. +                  return -EIO;
  308. +              }
  309. +              res = put_stack_long(child, addr, data);
  310. +              if (res) {
  311. +                  set_failure(®s,res);
  312. +              }
  313. +              return res;
  314. +          }
  315.  
  316.          case PTRACE_SYSCALL: /* continue and stop at next 
  317.                      (return from) syscall */
  318.          case PTRACE_CONT: { /* restart after signal. */
  319.              if ((unsigned long) data > NSIG) {
  320. -               set_failure(®s,-EIO);
  321. -               return -EIO;
  322. +                set_failure(®s,-EIO);
  323. +                return -EIO;
  324.              }
  325.              if (request == PTRACE_SYSCALL)
  326.                  child->flags |= PF_TRACESYS;
  327. @@ -694,12 +698,13 @@
  328.                  child->flags &= ~PF_TRACESYS;
  329.              child->exit_code = data;
  330.              wake_up_process(child);
  331. +        /* make sure single-step breakpoint is gone. */
  332.              ptrace_cancel_bpt(child);
  333.              set_success(®s,data);
  334.              return 0;
  335.          }
  336.  
  337. - /*
  338. +/*
  339.   * make the child exit.  Best I can do is send it a sigkill. 
  340.   * perhaps it should be put in the status that it wants to 
  341.   * exit.
  342. @@ -707,14 +712,15 @@
  343.          case PTRACE_KILL: {
  344.              wake_up_process(child);
  345.              child->exit_code = SIGKILL;
  346. +        /* make sure single-step breakpoint is gone. */
  347.              ptrace_cancel_bpt(child);
  348.              return 0;
  349.          }
  350.  
  351. -        case PTRACE_SINGLESTEP: {  /* set the trap flag. */
  352. +        case PTRACE_SINGLESTEP: {  /* execute signle instruction. */
  353.              if ((unsigned long) data > NSIG) {
  354. -               set_failure(®s,-EIO);
  355. -               return -EIO;
  356. +                set_failure(®s,-EIO);
  357. +                return -EIO;
  358.              }
  359.              res = set_bpt(child);
  360.              if (res < 0) {
  361. @@ -723,14 +729,14 @@
  362.              child->flags &= ~PF_TRACESYS;
  363.              wake_up_process(child);
  364.              child->exit_code = data;
  365. -            /* give it a chance to run. */
  366. +    /* give it a chance to run. */
  367.              return 0;
  368.          }
  369.  
  370.          case PTRACE_DETACH: { /* detach a process that was attached. */
  371.              if ((unsigned long) data > NSIG) {
  372. -               set_failure(®s,-EIO);
  373. -               return -EIO;
  374. +                set_failure(®s,-EIO);
  375. +                return -EIO;
  376.              }
  377.              child->flags &= ~(PF_PTRACED|PF_TRACESYS);
  378.              wake_up_process(child);
  379. @@ -738,17 +744,15 @@
  380.              REMOVE_LINKS(child);
  381.              child->p_pptr = child->p_opptr;
  382.              SET_LINKS(child);
  383. -            /* make sure the single step bit is not set. */
  384. +        /* make sure single-step breakpoint is gone. */
  385.              ptrace_cancel_bpt(child);
  386.              return 0;
  387.          }
  388.  
  389.          default:
  390. -        {
  391. -           set_failure(®s,-EIO);
  392. -           return -EIO;
  393. -        }
  394. -    }
  395. +          set_failure(®s,-EIO);
  396. +          return -EIO;
  397. +      }
  398.  }
  399.  
  400.  asmlinkage void syscall_trace(void)
  401. diff -u --recursive --new-file v1.3.11/linux/arch/alpha/kernel/setup.c linux/arch/alpha/kernel/setup.c
  402. --- v1.3.11/linux/arch/alpha/kernel/setup.c    Tue Jun 27 14:11:30 1995
  403. +++ linux/arch/alpha/kernel/setup.c    Mon Jul 24 17:38:25 1995
  404. @@ -130,6 +130,9 @@
  405.      };
  406.      struct percpu_struct *cpu;
  407.      unsigned int cpu_index, system_index;
  408. +    extern struct unaligned_stat {
  409. +        unsigned long count, va, pc;
  410. +    } unaligned;
  411.  #    define N(a)    (sizeof(a)/sizeof(a[0]))
  412.  
  413.      cpu = (struct percpu_struct*)((char*)hwrpb + hwrpb->processor_offset);
  414. @@ -151,7 +154,8 @@
  415.                 "page size [bytes]\t: %ld\n"
  416.                 "phys. address bits\t: %ld\n"
  417.                 "max. addr. space #\t: %ld\n"
  418. -               "BogoMIPS\t\t: %lu.%02lu\n",
  419. +               "BogoMIPS\t\t: %lu.%02lu\n"
  420. +               "unaligned accesses\t: %ld (pc=%lx,va=%lx)\n",
  421.  
  422.                 (cpu_index < N(cpu_name) ? cpu_name[cpu_index] : "Unknown"),
  423.                 cpu->variation, cpu->revision, (char*)cpu->serial_no,
  424. @@ -164,6 +168,7 @@
  425.                 hwrpb->pagesize,
  426.                 hwrpb->pa_bits,
  427.                 hwrpb->max_asn,
  428. -               loops_per_sec / 500000, (loops_per_sec / 5000) % 100);
  429. +               loops_per_sec / 500000, (loops_per_sec / 5000) % 100,
  430. +               unaligned.count, unaligned.pc, unaligned.va);
  431.  #       undef N
  432.  }
  433. diff -u --recursive --new-file v1.3.11/linux/arch/alpha/kernel/signal.c linux/arch/alpha/kernel/signal.c
  434. --- v1.3.11/linux/arch/alpha/kernel/signal.c    Thu Jun  1 13:22:06 1995
  435. +++ linux/arch/alpha/kernel/signal.c    Mon Jul 24 17:38:25 1995
  436. @@ -214,6 +214,9 @@
  437.      unsigned long pc = 0;
  438.      unsigned long signr;
  439.      struct sigaction * sa;
  440. +    extern ptrace_cancel_bpt (struct task_struct *child);
  441. +
  442. +    ptrace_cancel_bpt(current);    /* make sure single-step bpt is gone */
  443.  
  444.      while ((signr = current->signal & mask) != 0) {
  445.          signr = ffz(~signr);
  446. diff -u --recursive --new-file v1.3.11/linux/arch/alpha/kernel/traps.c linux/arch/alpha/kernel/traps.c
  447. --- v1.3.11/linux/arch/alpha/kernel/traps.c    Thu Jul 13 16:20:19 1995
  448. +++ linux/arch/alpha/kernel/traps.c    Mon Jul 24 17:38:25 1995
  449. @@ -67,8 +67,6 @@
  450.          if (ptrace_cancel_bpt(current)) {
  451.              regs.pc -= 4;    /* make pc point to former bpt */
  452.          }
  453. -        if (current->flags & PF_PTRACED)
  454. -          current->blocked &= ~(1 << (SIGTRAP - 1));
  455.          send_sig(SIGTRAP, current, 1);
  456.          break;
  457.  
  458. @@ -90,9 +88,8 @@
  459.   * fp-regs), and it needs to have them in order for simpler access.
  460.   *
  461.   * Due to the non-standard register layout (and because we don't want
  462. - * to handle floating-point regs), we disallow user-mode unaligned
  463. - * accesses (we'd need to do "verify_area()" checking, as well as
  464. - * do a full "ret_from_sys_call" return).
  465. + * to handle floating-point regs), user-mode unaligned accesses are
  466. + * handled separately by do_entUnaUser below.
  467.   *
  468.   * Oh, btw, we don't handle the "gp" register correctly, but if we fault
  469.   * on a gp-register unaligned load/store, something is _very_ wrong
  470. @@ -103,17 +100,24 @@
  471.      unsigned long ps, pc, gp, a0, a1, a2;
  472.  };
  473.  
  474. +struct unaligned_stat {
  475. +    unsigned long count, va, pc;
  476. +} unaligned;
  477. +
  478.  asmlinkage void do_entUna(void * va, unsigned long opcode, unsigned long reg,
  479.      unsigned long a3, unsigned long a4, unsigned long a5,
  480.      struct allregs regs)
  481.  {
  482.      static int cnt = 0;
  483.  
  484. -    if (regs.ps & 8)
  485. -        do_exit(SIGSEGV);
  486.      if (++cnt < 5)
  487.          printk("Unaligned trap at %016lx: %p %lx %ld\n",
  488.              regs.pc, va, opcode, reg);
  489. +
  490. +    ++unaligned.count;
  491. +    unaligned.va = (unsigned long) va - 4;
  492. +    unaligned.pc = regs.pc;
  493. +
  494.      /* $16-$18 are PAL-saved, and are offset by 19 entries */
  495.      if (reg >= 16 && reg <= 18)
  496.          reg += 19;
  497. @@ -134,6 +138,22 @@
  498.      printk("Bad unaligned kernel access at %016lx: %p %lx %ld\n",
  499.          regs.pc, va, opcode, reg);
  500.      do_exit(SIGSEGV);
  501. +}
  502. +
  503. +/*
  504. + * Handle user-level unaligned fault.  For now, simply send a
  505. + * SIGSEGV---there should be little reason for users not wanting to
  506. + * fix their code instead.  Notice that we have the regular kernel
  507. + * stack layout here, so finding the appropriate registers is a little
  508. + * more difficult than in the kernel case.  Also, we'd need to do
  509. + * a "verify_area()" before accessing memory on behalf of the user.
  510. + */
  511. +asmlinkage void do_entUnaUser(void *va, unsigned long opcode, unsigned long reg,
  512. +                  unsigned long a3, unsigned long a4, unsigned long a5,
  513. +                  struct pt_regs regs)
  514. +{
  515. +    regs.pc -= 4;    /* make pc point to faulting insn */
  516. +    send_sig(SIGSEGV, current, 1);
  517.  }
  518.  
  519.  /*
  520. diff -u --recursive --new-file v1.3.11/linux/drivers/block/README.aztcd linux/drivers/block/README.aztcd
  521. --- v1.3.11/linux/drivers/block/README.aztcd    Tue Jul 11 10:02:48 1995
  522. +++ linux/drivers/block/README.aztcd    Tue Jul 25 10:17:15 1995
  523. @@ -1,7 +1,7 @@
  524.                         Readme-File README.aztcd
  525.     for Aztech CD-ROM CDA268-01A, ORCHID CD-3110, OKANO/WEARNES CDD110 
  526.                            CD-ROM  Driver 
  527. -                       Version 1.2 and newer
  528. +                       Version 1.4 and newer
  529.                     (for other drives see 6.-8.)
  530.  
  531.  NOTE: THIS DRIVER WILL WORK WITH THE CD-ROM DRIVES LISTED, WHICH HAVE
  532. @@ -104,6 +104,8 @@
  533.    have to set up. If you have a soundcard, read chapter 4.2.
  534.    Users of other drives should read chapter OTHER DRIVES of this file.
  535.    You also can configure that address by LILO boot parameter aztcd=... 
  536. +- There are some other points, which may be configured, e.g. auto-eject the
  537. +  CD when umounting a drive, tray locking etc., see aztcd.h for details.
  538.  - Build a new kernel, configure it for 'Aztech/Orchid/Okano/Wearnes support' 
  539.    (if you want aztcd to be part of the kernel). Do not configure it for
  540.    'Aztech... support', if you want to use aztcd as a run time loadable module. 
  541. @@ -139,7 +141,9 @@
  542.  kernel, if necessary. 
  543.  
  544.  Now edit the base address of your AZTECH interface card in
  545. -/usr/src/linux/include/linux/aztcd.h to the appropriate value. Then change
  546. +/usr/src/linux/include/linux/aztcd.h to the appropriate value. There are
  547. +also some special features which may be configured, e.g. auto-eject a CD
  548. +when unmounting the drive etc; see aztcd.h for details. Then change
  549.  to /usr/src/linux and do a 
  550.                      make modules  
  551.                  make modules_install
  552. @@ -175,11 +179,12 @@
  553.  
  554.  5. KNOWN PROBLEMS, FUTURE DEVELOPMENTS
  555.  5.1 MULTISESSION SUPPORT
  556. -The driver does not support applications such as photo CD, multi session CD
  557. -etc.. I do not plan to include the support for that in the driver, because I
  558. -do not use such applications. If you are interested in that stuff and would
  559. -like to extend the drivers capability on your own, please contact me, I'll
  560. -support you as far as I can. 
  561. +I have now (July 1995) started support of multisession CDs. Unfortunately I
  562. +do neither have a multisession CD nor use appropriate applications, so I can
  563. +program, but will not test it :-(. If you'd like to help me, please contact
  564. +me. As of version 1.4 you can enable the multisession support in aztcd.h by
  565. +setting AZT_MULTISESSION to 1. As I have not tested it, I don't know, if it
  566. +works ...
  567.  
  568.  5.2 STATUS RECOGNITION
  569.  The drive status recognition does not work correctly in all cases. Changing
  570. @@ -210,7 +215,10 @@
  571.  in combination with aztcd :-) ! Unfortunately up to now, I could not locate
  572.  the root cause of that problem. It seems to be somewhere in the interaction
  573.  of the kernel with dosemu's and aztcd's buffers. I appreciate any help on
  574. -this subject !
  575. +this subject ! 
  576. +This problem has now (July 1995) been fixed by a modification to dosemu's
  577. +CD-ROM driver, but it is unclear, with which version of dosemu this modi-
  578. +fication will officially be included.
  579.  
  580.  6. BUG REPORTS
  581.  Please send detailed bug reports and bug fixes via EMail to
  582. diff -u --recursive --new-file v1.3.11/linux/drivers/block/README.cm206 linux/drivers/block/README.cm206
  583. --- v1.3.11/linux/drivers/block/README.cm206    Fri Jul  7 08:54:44 1995
  584. +++ linux/drivers/block/README.cm206    Wed Jul 19 10:15:42 1995
  585. @@ -6,7 +6,8 @@
  586.  Features as of version 0.33
  587.  ---------------------------
  588.  - Full audio support, that is, both  workman, workbone and cdp work
  589. -  now reasonably. Reading TOC still takes some time. 
  590. +  now reasonably. Reading TOC still takes some time. xmcd has been
  591. +  reported to run successfully. 
  592.  - Made auto-probe code a little better, i hope
  593.  
  594.  Features as of version 0.28
  595. @@ -41,12 +42,6 @@
  596.     autoprobing, which is the default. In that case you can move on to
  597.     the next step.
  598.  
  599. -   If autoprobing does not work, you can hard-wire the default values
  600. -   of the base port address (CM206_BASE) and interrupt request line
  601. -   (CM206_IRQ) into the file ./linux/drivers/block/cm206.c. Uncomment
  602. -   the defines of CM206_IRQ and CM206_BASE, and change there meaning
  603. -   to the appropriate values, if necessary.
  604. -
  605.  Compiling the kernel
  606.  --------------------
  607.  1) move to /usr/src/linux and do a 
  608. @@ -54,14 +49,14 @@
  609.      make config
  610.  
  611.     If you have chosen for option (a), answer yes to CONFIG_CM206 and
  612. -   CONFIG_ISO9660_FS (should be default).
  613. +   CONFIG_ISO9660_FS.
  614.  
  615.     If you have chosen for option (b), answer yes to CONFIG_MODVERSIONS
  616.     and no (!) to CONFIG_CM206 and CONFIG_ISO9660_FS. 
  617.  
  618.  2) then do a 
  619.      
  620. -    make dep; make zImage; make modules
  621. +    make dep; make clean; make zImage; make modules
  622.  
  623.  3) do the usual things to install a new image (backup the old one, run
  624.     `rdev -R zImage 1', copy the new image in place, run lilo).  Might
  625. @@ -82,8 +77,10 @@
  626.  
  627.      insmod /usr/src/linux/modules/cm206.o cm206=0x300,11
  628.  
  629. -You may also have to install the file-system module `iso9660.o', if you
  630. -didn't compile that into the kernel. If you use `tcsh' as shell, you
  631. +The order of base port and irq line don't matter; you may specify only
  632. +one, the other will have the value of the compiled-in default.  You
  633. +may also have to install the file-system module `iso9660.o', if you
  634. +didn't compile that into the kernel. (If you use `tcsh' as shell, you
  635.  might consider defining
  636.  
  637.      alias listinstalledmodules 'cat /proc/modules | awk \{print\$1\}'
  638. @@ -92,7 +89,7 @@
  639.      alias insmod        'insmod /usr/src/linux/modules/\!:1 \!:2*'
  640.      complete insmod        'p/1/`listcompiledmodules`/'
  641.  
  642. -which makes typing insmod and rmmod somewhat easier. 
  643. +which makes typing insmod and rmmod somewhat easier.)
  644.  
  645.  Using the driver as part of the kernel
  646.  --------------------------------------
  647. @@ -105,6 +102,15 @@
  648.  If you may specify either IRQ (3--11) or base port (0x300--0x370),
  649.  auto probing is turned off for both settings, thus setting the 
  650.  other value to the compiled-in default.
  651. +
  652. +If module parameters and LILO config options don't work
  653. +-------------------------------------------------------
  654. +If autoprobing does not work, you can hard-wire the default values
  655. +of the base port address (CM206_BASE) and interrupt request line
  656. +(CM206_IRQ) into the file ./include/linux/cm206.h. Change
  657. +the defines of CM206_IRQ and CM206_BASE.
  658. +
  659. +
  660.  
  661.  Mounting the cdrom
  662.  ------------------
  663. diff -u --recursive --new-file v1.3.11/linux/drivers/block/aztcd.c linux/drivers/block/aztcd.c
  664. --- v1.3.11/linux/drivers/block/aztcd.c    Tue Jul 11 10:02:49 1995
  665. +++ linux/drivers/block/aztcd.c    Tue Jul 25 10:17:15 1995
  666. @@ -1,5 +1,5 @@
  667. -#define AZT_VERSION "1.30"
  668. -/*      $Id: aztcd.c,v 1.30 1995/07/04 08:28:06 root Exp $
  669. +#define AZT_VERSION "1.40"
  670. +/*      $Id: aztcd.c,v 1.40 1995/07/15 20:35:15 root Exp root $
  671.      linux/drivers/block/aztcd.c - AztechCD268 CDROM driver
  672.  
  673.      Copyright (C) 1994,1995 Werner Zimmermann (zimmerma@rz.fht-esslingen.de)
  674. @@ -116,6 +116,10 @@
  675.                  Werner Zimmermann, May 22, 95
  676.      V1.30   Auto-eject feature. Inspired by Franc Racis (racis@psu.edu)
  677.              Werner Zimmermann, July 4, 95
  678. +    V1.40   Started multisession support. Implementation copied from mcdx.c
  679. +            by Heiko Schlittermann. Not tested, as I do not have a multi-
  680. +            session CD. If you can test it, please contact me.
  681. +            Werner Zimmermann, July 15, 95
  682.      NOTE: 
  683.      Points marked with ??? are questionable !
  684.  */
  685. @@ -189,7 +193,7 @@
  686.  static volatile int azt_transfer_is_active=0;
  687.  
  688.  static char azt_buf[2048*AZT_BUF_SIZ];  /*buffer for block size conversion*/
  689. -#ifdef AZT_PRIVATE_IOCTLS
  690. +#if AZT_PRIVATE_IOCTLS
  691.  static char buf[2336];                  /*separate buffer for the ioctls*/
  692.  #endif
  693.  
  694. @@ -364,7 +368,7 @@
  695.  
  696.  static void aztLockDoor(void)
  697.  {
  698. -#ifdef AZT_ALLOW_TRAY_LOCK
  699. +#if AZT_ALLOW_TRAY_LOCK
  700.    aztSendCmd(ACMD_LOCK);
  701.    STEN_LOW;
  702.  #endif
  703. @@ -373,7 +377,7 @@
  704.  
  705.  static void aztUnlockDoor(void)
  706.  {
  707. -#ifdef AZT_ALLOW_TRAY_LOCK
  708. +#if AZT_ALLOW_TRAY_LOCK
  709.    aztSendCmd(ACMD_UNLOCK);
  710.    STEN_LOW;
  711.  #endif
  712. @@ -523,7 +527,7 @@
  713.  
  714.  long azt_msf2hsg(struct msf *mp)
  715.  { return azt_bcd2bin(mp -> frame) + azt_bcd2bin(mp -> sec) * 75
  716. -                          + azt_bcd2bin(mp -> min) * 4500 - 150;
  717. +                          + azt_bcd2bin(mp -> min) * 4500 - CD_BLOCK_OFFSET;
  718.  }
  719.  
  720.  static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg)
  721. @@ -550,7 +554,7 @@
  722.      {
  723.      case CDROMSTART:     /* Spin up the drive. Don't know, what to do,
  724.                              at least close the tray */
  725. -#ifdef AZT_PRIVATE_IOCTLS 
  726. +#if AZT_PRIVATE_IOCTLS 
  727.              if (aztSendCmd(ACMD_CLOSE)) RETURNM("aztcd_ioctl 4",-1);
  728.              STEN_LOW_WAIT;
  729.  #endif
  730. @@ -585,6 +589,47 @@
  731.          }
  732.          aztAudioStatus = CDROM_AUDIO_PLAY;
  733.          break;
  734. +#if AZT_MULTISESSION
  735. +    case CDROMMULTISESSION: /*multisession support -- not tested ???*/
  736. +            { struct cdrom_multisession ms;
  737. +#ifdef AZT_DEBUG
  738. +             printk("aztcd ioctl MULTISESSION\n");
  739. +#endif
  740. +          st = verify_area(VERIFY_READ, (void*) arg, sizeof(struct cdrom_multisession));
  741. +          if (st) return st;
  742. +          memcpy_fromfs(&ms, (void*) arg, sizeof(struct cdrom_multisession));
  743. +          if (ms.addr_format == CDROM_MSF) 
  744. +             { ms.addr.msf.minute = azt_bcd2bin(DiskInfo.lastTrack.min);
  745. +               ms.addr.msf.second = azt_bcd2bin(DiskInfo.lastTrack.sec);
  746. +               ms.addr.msf.frame  = azt_bcd2bin(DiskInfo.lastTrack.frame);
  747. +             } 
  748. +          else if (ms.addr_format == CDROM_LBA)
  749. +               ms.addr.lba = azt_msf2hsg(&DiskInfo.lastTrack);
  750. +          else
  751. +               return -EINVAL;
  752. +          if (DiskInfo.type == CD_XA) 
  753. +             { ms.xa_flag = 0x01;       /*XA-Disk*/
  754. +             }
  755. +          else
  756. +             { ms.xa_flag = 0x00;   
  757. +             }
  758. +           st = verify_area(VERIFY_WRITE, (void*) arg, sizeof(struct cdrom_multisession));
  759. +          if (st) return st;
  760. +            memcpy_tofs((void*) arg, &ms, sizeof(struct cdrom_multisession));
  761. +#ifdef AZT_DEBUG 
  762. +           if (ms.addr_format == CDROM_MSF) 
  763. +                      printk("aztcd multisession %d, %02x:%02x.%02x [%02x:%02x.%02x])\n",
  764. +                  ms.xa_flag, ms.addr.msf.minute, ms.addr.msf.second, 
  765. +                  ms.addr.msf.frame, DiskInfo.lastTrack.min,
  766. +                  DiskInfo.lastTrack.sec, DiskInfo.lastTrack.frame);
  767. +          else
  768. +              printk("atzcd multisession %d, 0x%08x [%02x:%02x.%02x])\n",
  769. +                  ms.xa_flag, ms.addr.lba, DiskInfo.lastTrack.min,
  770. +                  DiskInfo.lastTrack.sec, DiskInfo.lastTrack.frame);
  771. +#endif
  772. +             return 0;
  773. +        }
  774. +#endif
  775.      case CDROMPLAYTRKIND:     /* Play a track.  This currently ignores index. */
  776.          st = verify_area(VERIFY_READ, (void *) arg, sizeof ti);
  777.          if (st) return st;
  778. @@ -595,7 +640,7 @@
  779.          { return -EINVAL;
  780.          }
  781.          if (ti.cdti_trk1 > DiskInfo.last)
  782. -           ti. cdti_trk1 = DiskInfo.last;
  783. +            ti.cdti_trk1 = DiskInfo.last;
  784.          azt_Play.start = Toc[ti.cdti_trk0].diskTime;
  785.          azt_Play.end = Toc[ti.cdti_trk1 + 1].diskTime;
  786.  #ifdef AZT_DEBUG
  787. @@ -758,10 +803,10 @@
  788.      case CDROMREADMODE1: /*read data in mode 1 (2048 Bytes)*/
  789.      case CDROMREADMODE2: /*read data in mode 2 (2336 Bytes)*/
  790.  /*Take care, the following code is not compatible with other CD-ROM drivers,
  791. -  use it at your own risk with cdplay.c. Normally it is not activated, as 
  792. -  AZT_PRIVATE_IOCTLS is not defined
  793. +  use it at your own risk with cdplay.c. Set AZT_PRIVATE_IOCTLS to 0 in aztcd.h,
  794. +  if you do not want to use it!
  795.  */                  
  796. -#ifdef AZT_PRIVATE_IOCTLS 
  797. +#if AZT_PRIVATE_IOCTLS 
  798.          { st = verify_area(VERIFY_READ,  (void *) arg, sizeof msf);
  799.            if (st) return st;
  800.            st = verify_area(VERIFY_WRITE, (void *) arg, sizeof buf);
  801. @@ -1653,12 +1698,12 @@
  802.    for (limit=300;limit>0;limit--)
  803.     {  if (aztGetQChannelInfo(&qInfo)<0) RETURNM("aztGetDiskInfo 2",-1);
  804.        if (qInfo.pointIndex==0xA0)   /*Number of FirstTrack*/
  805. -    { DiskInfo.first=qInfo.diskTime.min;
  806. +    { DiskInfo.first = qInfo.diskTime.min;
  807.        DiskInfo.first = azt_bcd2bin(DiskInfo.first);
  808.        test=test|0x01;
  809.      }
  810.        if (qInfo.pointIndex==0xA1)   /*Number of LastTrack*/
  811. -    { DiskInfo.last=qInfo.diskTime.min;
  812. +    { DiskInfo.last  = qInfo.diskTime.min;
  813.        DiskInfo.last  = azt_bcd2bin(DiskInfo.last);
  814.        test=test|0x02;
  815.      }
  816. @@ -1692,7 +1737,6 @@
  817.    return 0;
  818.  }
  819.  
  820. -
  821.  /*
  822.   * Read the table of contents (TOC)
  823.   */
  824. @@ -1737,6 +1781,18 @@
  825.  
  826.      Toc[DiskInfo.last + 1].diskTime = DiskInfo.diskLength;
  827.  
  828. +        DiskInfo.lastTrack.sec=2;
  829. +        DiskInfo.type = 0; 
  830. +        for (i=0;i<=DiskInfo.last;i++) /*Unterscheidung zw. Audio- und Datendisk???*/
  831. +          { if ((Toc[i].ctrl_addr)==0x01)      
  832. +                DiskInfo.type=DiskInfo.type|CD_AUDIO; 
  833. +            if ((Toc[i].ctrl_addr)==0x41)
  834. +                DiskInfo.type=DiskInfo.type|CD_DATA;     
  835. +          }
  836. +        DiskInfo.lastTrack.min  =Toc[DiskInfo.last].diskTime.min;
  837. +    DiskInfo.lastTrack.sec  =Toc[DiskInfo.last].diskTime.sec;
  838. +        DiskInfo.lastTrack.frame=Toc[DiskInfo.last].diskTime.frame;
  839. +
  840.  #ifdef AZT_DEBUG
  841.  printk("aztcd: exiting aztGetToc  Time:%li\n",jiffies);
  842.  for (i = 1; i <= DiskInfo.last+1; i++)
  843. @@ -1749,6 +1805,19 @@
  844.  i, Toc[i].ctrl_addr, Toc[i].track, Toc[i].pointIndex,
  845.  Toc[i].trackTime.min, Toc[i].trackTime.sec, Toc[i].trackTime.frame,
  846.  Toc[i].diskTime.min, Toc[i].diskTime.sec, Toc[i].diskTime.frame);
  847. +printk("\nDisk Info: first %d last %d length %02x:%02x.%02x first %02x:%02x.%02x last %02x:%02x.%02x type %02x\n",
  848. +    DiskInfo.first,
  849. +    DiskInfo.last,
  850. +    DiskInfo.diskLength.min,
  851. +    DiskInfo.diskLength.sec,
  852. +    DiskInfo.diskLength.frame,
  853. +    DiskInfo.firstTrack.min,
  854. +    DiskInfo.firstTrack.sec,
  855. +    DiskInfo.firstTrack.frame,
  856. +    DiskInfo.lastTrack.min,
  857. +    DiskInfo.lastTrack.sec,
  858. +    DiskInfo.lastTrack.frame,
  859. +        DiskInfo.type);
  860.  #endif
  861.  
  862.      return limit > 0 ? 0 : -1;
  863. diff -u --recursive --new-file v1.3.11/linux/drivers/block/cdu31a.c linux/drivers/block/cdu31a.c
  864. --- v1.3.11/linux/drivers/block/cdu31a.c    Thu Jul 13 16:20:20 1995
  865. +++ linux/drivers/block/cdu31a.c    Wed Jul 19 08:40:50 1995
  866. @@ -325,6 +325,11 @@
  867.  static int readahead_dataleft = 0;
  868.  static int readahead_bad = 0;
  869.  
  870. +/* Used to time a short period to abort an operation after the
  871. +   drive has been idle for a while.  This keeps the light on
  872. +   the drive from flashing for very long. */
  873. +static struct timer_list cdu31a_abort_timer;
  874. +
  875.  
  876.  /*
  877.   * This routine returns 1 if the disk has been changed since the last
  878. @@ -1096,6 +1101,14 @@
  879.     readahead_bad = 0;
  880.  }
  881.  
  882. +/* Called when the timer times out.  This will abort the
  883. +   pending read operation. */
  884. +static void
  885. +handle_abort_timeout(unsigned long data)
  886. +{
  887. +   abort_read();
  888. +}
  889. +
  890.  /* Actually get data and status from the drive. */
  891.  static void
  892.  input_data(char         *buffer,
  893. @@ -1392,17 +1405,24 @@
  894.           {
  895.              end_request(0);
  896.           }
  897. +         restore_flags(flags);
  898.           return;
  899.        }
  900.     }
  901.     sony_inuse = 1;
  902.     has_cd_task = current;
  903. -   restore_flags(flags);
  904. +   sti();
  905.  
  906.     /* Get drive status before doing anything. */
  907.     while (handle_sony_cd_attention())
  908.        ;
  909.  
  910. +   /* If the timer is running, cancel it. */
  911. +   if (cdu31a_abort_timer.next != NULL)
  912. +   {
  913. +      del_timer(&cdu31a_abort_timer);
  914. +   }
  915. +
  916.     while (1)
  917.     {
  918.  cdu31a_request_startover:
  919. @@ -1573,14 +1593,20 @@
  920.     }
  921.  
  922.  end_do_cdu31a_request:
  923. -#if 1
  924. +#if 0
  925.     /* After finished, cancel any pending operations. */
  926.     abort_read();
  927. +#else
  928. +   /* Start a timer to time out after a while to disable
  929. +      the read. */
  930. +   cdu31a_abort_timer.expires = 200; /* Wait 2 seconds */
  931. +   add_timer(&cdu31a_abort_timer);
  932.  #endif
  933.  
  934.     has_cd_task = NULL;
  935.     sony_inuse = 0;
  936.     wake_up_interruptible(&sony_wait);
  937. +   restore_flags(flags);
  938.  }
  939.  
  940.  /* Copy overlapping buffers. */
  941. @@ -2969,6 +2995,10 @@
  942.        mem_start += CD_FRAMESIZE_RAW;
  943.        sony_toc = (struct s_sony_session_toc *) mem_start;
  944.        mem_start += sizeof(struct s_sony_session_toc);
  945. +
  946. +      cdu31a_abort_timer.next = NULL;
  947. +      cdu31a_abort_timer.prev = NULL;
  948. +      cdu31a_abort_timer.function = handle_abort_timeout;
  949.     }
  950.  
  951.  
  952. diff -u --recursive --new-file v1.3.11/linux/drivers/block/cm206.c linux/drivers/block/cm206.c
  953. --- v1.3.11/linux/drivers/block/cm206.c    Fri Jul  7 08:54:44 1995
  954. +++ linux/drivers/block/cm206.c    Wed Jul 19 10:15:42 1995
  955. @@ -53,6 +53,12 @@
  956.    1 jun 1995: 0.32 Removed probe_irq_on/off for module version.
  957.   10 jun 1995: 0.33 Workman still behaves funny, but you should be
  958.                able to eject and substitute another disc.
  959. +
  960. + An adaption of 0.33 is included in linux-1.3.7 by Eberhard Moenkeberg
  961. +
  962. + 18 jul 1996: 0.34 Patch by Heiko Eissfeldt included, mainly considering 
  963. +              verify_area's in the ioctls. Some bugs introduced by 
  964. +          EM considering the base port and irq fixed. 
  965.   * 
  966.   * Parts of the code are based upon lmscd.c written by Kai Petzke,
  967.   * sbpcd.c written by Eberhard Moenkeberg, and mcd.c by Martin
  968. @@ -73,7 +79,7 @@
  969.   * - Philips/LMS cm260 product specification
  970.   *
  971.   *                       David van Leeuwen, david@tm.tno.nl.  */
  972. -#define VERSION "0.33"
  973. +#define VERSION "0.34"
  974.  
  975.  #ifdef MODULE            /* OK, so some of this is stolen */
  976.  #include <linux/module.h>    
  977. @@ -95,6 +101,7 @@
  978.  #include <linux/timer.h>
  979.  #include <linux/cdrom.h>
  980.  #include <linux/ioport.h>
  981. +#include <linux/mm.h>
  982.  
  983.  #include <asm/io.h>
  984.  
  985. @@ -108,9 +115,8 @@
  986.  */
  987.  static int auto_probe=1;    /* Yes, why not? */
  988.  
  989. -#define cm206_base cm206 /* for compatible "insmod" parameter passing */
  990.  static int cm206_base = CM206_BASE;
  991. -static int cm206_irq = CM206_IRQ; /* must directly follow cm206_base */
  992. +static int cm206_irq = CM206_IRQ; 
  993.  
  994.  #undef DEBUG
  995.  #undef DEBUG_SECTORS
  996. @@ -674,10 +680,19 @@
  997.  int get_multi_session_info(struct cdrom_multisession * mssp)
  998.  {
  999.    if (!FIRST_TRACK) get_disc_status();
  1000. -  if (mssp && DISC_STATUS & cds_multi_session) { /* multi-session */
  1001. -    mssp->addr.lba = fsm2lba(&cd->disc_status[3]);
  1002. -    mssp->xa_flag = 1;        /* don't know */
  1003. -    mssp->addr_format = CDROM_LBA; /* too bad if fsm requested! */
  1004. +  if (mssp) {
  1005. +    if (DISC_STATUS & cds_multi_session) { /* multi-session */
  1006. +      if (mssp->addr_format == CDROM_LBA)
  1007. +          mssp->addr.lba = fsm2lba(&cd->disc_status[3]);
  1008. +      else {
  1009. +          mssp->addr.msf.frame = cd->disc_status[3];
  1010. +          mssp->addr.msf.second = cd->disc_status[4];
  1011. +          mssp->addr.msf.minute = cd->disc_status[5];
  1012. +      }
  1013. +      mssp->xa_flag = 1;
  1014. +    } else {
  1015. +      mssp->xa_flag = 0;
  1016. +    }
  1017.      return 1;
  1018.    }
  1019.    return 0;
  1020. @@ -889,33 +904,41 @@
  1021.  #endif    
  1022.    case CDROMMULTISESSION: {
  1023.      struct cdrom_multisession ms_info;
  1024. +    int st;
  1025.      stats(ioctl_multisession);
  1026. -    if (get_multi_session_info(&ms_info)) {
  1027. -      memcpy_tofs((struct cdrom_multisession *) arg, &ms_info, 
  1028. +
  1029. +    st=verify_area(VERIFY_WRITE, (void *) arg, 
  1030. +           sizeof(struct cdrom_multisession));
  1031. +    if (st) return (st);
  1032. +    memcpy_fromfs(&ms_info, (struct cdrom_multisession *) arg,
  1033.            sizeof(struct cdrom_multisession));
  1034. -      return 0;
  1035. -    }
  1036. -    else return -cmd;
  1037. +    get_multi_session_info(&ms_info);
  1038. +    memcpy_tofs((struct cdrom_multisession *) arg, &ms_info, 
  1039. +          sizeof(struct cdrom_multisession));
  1040. +    return 0;
  1041.    }
  1042. -  case CM206_RESET_DRIVE:
  1043. +  case CDROMRESET:        /* If needed, it's probably too late anyway */
  1044.      stop_read();
  1045.      reset_cm260();
  1046.      outw(dc_normal | dc_break | READ_AHEAD, r_data_control);
  1047.      udelay(1000);        /* 750 musec minimum */
  1048.      outw(dc_normal | READ_AHEAD, r_data_control);
  1049. -    cd->sector_last = -1;        /* flag no data buffered */
  1050. +    cd->sector_last = -1;    /* flag no data buffered */
  1051.      cd->adapter_last = -1;    
  1052.      return 0;
  1053.    }
  1054. +
  1055.    get_drive_status();
  1056.    if (cd->dsb & (dsb_drive_not_ready | dsb_tray_not_closed) )
  1057.      return -EAGAIN; 
  1058. +
  1059.    switch (cmd) {
  1060.    case CDROMREADTOCHDR: {
  1061.      struct cdrom_tochdr header;
  1062. -    get_drive_status();
  1063. -    if (cd->dsb & (dsb_drive_not_ready | dsb_tray_not_closed) )
  1064. -      return -EAGAIN; 
  1065. +    int st;
  1066. +
  1067. +    st=verify_area(VERIFY_WRITE, (void *) arg, sizeof(header));
  1068. +    if (st) return (st);
  1069.      if (read_toc_header(&header)) {
  1070.        memcpy_tofs((struct cdrom_tochdr *) arg, &header, sizeof(header));
  1071.        return 0;
  1072. @@ -924,6 +947,10 @@
  1073.    }
  1074.    case CDROMREADTOCENTRY: {    
  1075.      struct cdrom_tocentry entry;
  1076. +    int st;
  1077. +
  1078. +    st=verify_area(VERIFY_WRITE, (void *) arg, sizeof(entry));
  1079. +    if (st) return (st);
  1080.      memcpy_fromfs(&entry, (struct cdrom_tocentry *) arg, sizeof entry);
  1081.      get_toc_entry(&entry);
  1082.      memcpy_tofs((struct cdrom_tocentry *) arg, &entry, sizeof entry);
  1083. @@ -931,12 +958,20 @@
  1084.    }
  1085.    case CDROMPLAYMSF: {
  1086.      struct cdrom_msf msf;
  1087. +    int st;
  1088. +
  1089. +    st=verify_area(VERIFY_READ, (void *) arg, sizeof(msf));
  1090. +    if (st) return (st);
  1091.      memcpy_fromfs(&msf, (struct cdrom_mdf *) arg, sizeof msf);
  1092.      play_from_to_msf(&msf);
  1093.      return 0;
  1094.    }
  1095.    case CDROMPLAYTRKIND: {
  1096.      struct cdrom_ti track_index;
  1097. +    int st;
  1098. +
  1099. +    st=verify_area(VERIFY_READ, (void *) arg, sizeof(track_index));
  1100. +    if (st) return (st);
  1101.      memcpy_fromfs(&track_index, (struct cdrom_ti *) arg, sizeof(track_index));
  1102.      play_from_to_track(track_index.cdti_trk0, track_index.cdti_trk1);
  1103.      return 0;
  1104. @@ -970,6 +1005,10 @@
  1105.      return 0;
  1106.    case CDROMSUBCHNL: {
  1107.      struct cdrom_subchnl q;
  1108. +    int st;
  1109. +
  1110. +    st=verify_area(VERIFY_WRITE, (void *) arg, sizeof(q));
  1111. +    if (st) return (st);
  1112.      memcpy_fromfs(&q, (struct cdrom_subchnl *) arg, sizeof q);
  1113.      if (get_current_q(&q)) {
  1114.        memcpy_tofs((struct cdrom_subchnl *) arg, &q, sizeof q);
  1115. @@ -979,6 +1018,10 @@
  1116.    }
  1117.    case CDROM_GET_UPC: {
  1118.      uch upc[10];
  1119. +    int st;
  1120. +
  1121. +    st=verify_area(VERIFY_WRITE, (void *) arg, 8);
  1122. +    if (st) return (st);
  1123.      if (type_1_command(c_read_upc, 10, upc)) return -EIO;
  1124.      memcpy_tofs((uch *) arg, &upc[1], 8);
  1125.      return 0;
  1126. @@ -1081,14 +1124,36 @@
  1127.  }
  1128.  #endif
  1129.  
  1130. -/* Wow is this piece of #ifdeffing ugly! */
  1131.  #ifdef MODULE
  1132.  #define OK  0
  1133.  #define ERROR  -EIO
  1134. -int init_module(void)
  1135. -#else
  1136. +
  1137. +static int cm206[2] = {0,0};    /* for compatible `insmod' parameter passing */
  1138. +void parse_options() 
  1139. +{
  1140. +  int i;
  1141. +  for (i=0; i<2; i++) {
  1142. +    if (0x300 <= cm206[i] && i<= 0x370 && cm206[i] % 0x10 == 0) {
  1143. +      cm206_base = cm206[i];
  1144. +      auto_probe=0;
  1145. +    }
  1146. +    else if (3 <= cm206[i] && cm206[i] <= 15) {
  1147. +      cm206_irq = cm206[i];
  1148. +      auto_probe=0;
  1149. +    }
  1150. +  }
  1151. +}
  1152. +
  1153. +#else MODULE
  1154. +
  1155.  #define OK  mem_start+size
  1156.  #define ERROR  mem_start
  1157. +
  1158. +#endif MODULE
  1159. +
  1160. +#ifdef MODULE
  1161. +int init_module(void)
  1162. +#else 
  1163.  unsigned long cm206_init(unsigned long mem_start, unsigned long mem_end)
  1164.  #endif
  1165.  {
  1166. @@ -1096,8 +1161,11 @@
  1167.    long int size=sizeof(struct cm206_struct);
  1168.  
  1169.    printk("cm206: v" VERSION);
  1170. -#if defined(MODULE) && !defined(AUTO_PROBE_MODULE)
  1171. -  auto_probe=0;
  1172. +#if defined(MODULE) 
  1173. +  parse_options();
  1174. +#if !defined(AUTO_PROBE_MODULE)
  1175. +   auto_probe=0;
  1176. +#endif
  1177.  #endif
  1178.    cm206_base = probe_base_port(auto_probe ? 0 : cm206_base);
  1179.    if (!cm206_base) {
  1180. @@ -1173,7 +1241,7 @@
  1181.    cleanup(4);
  1182.    printk("cm206 removed\n");
  1183.  }
  1184. -
  1185. +      
  1186.  #else MODULE
  1187.  
  1188.  /* This setup function accepts either `auto' or numbers in the range
  1189. @@ -1181,9 +1249,7 @@
  1190.  void cm206_setup(char *s, int *p)
  1191.  {
  1192.    int i;
  1193. -#ifdef AUTO_PROBE_MODULE
  1194.    if (!strcmp(s, "auto")) auto_probe=1;
  1195. -#endif
  1196.    for(i=1; i<=p[0]; i++) {
  1197.      if (0x300 <= p[i] && i<= 0x370 && p[i] % 0x10 == 0) {
  1198.        cm206_base = p[i];
  1199. diff -u --recursive --new-file v1.3.11/linux/drivers/block/mcd.c linux/drivers/block/mcd.c
  1200. --- v1.3.11/linux/drivers/block/mcd.c    Fri Jul  7 08:54:45 1995
  1201. +++ linux/drivers/block/mcd.c    Tue Jul 25 10:17:15 1995
  1202. @@ -38,9 +38,28 @@
  1203.      November 93 added code for FX001 S,D (single & double speed).
  1204.      February 94 added code for broken M 5/6 series of 16-bit single speed.
  1205.  
  1206. -        0.4   Added support for loadable MODULEs, so mcd can now also be
  1207. -              loaded by insmod and removed by rmmod during runtime.
  1208. -              Werner Zimmermann (zimmerma@rz.fht-esslingen.de), Mar. 26, 95
  1209. +
  1210. +        0.4   
  1211. +        Added support for loadable MODULEs, so mcd can now also be loaded by 
  1212. +        insmod and removed by rmmod during runtime.
  1213. +        Werner Zimmermann (zimmerma@rz.fht-esslingen.de), Mar. 26, 95
  1214. +
  1215. +    0.5
  1216. +    I added code for FX001 D to drop from double speed to single speed 
  1217. +    when encountering errors... this helps with some "problematic" CD's
  1218. +    that are supposedly "OUT OF TOLERANCE" (but are really shitty presses!)
  1219. +    severly scratched, or possibly slightly warped! I have noticed that
  1220. +    the Mitsumi 2x/4x drives are just less tolerant and the firmware is 
  1221. +    not smart enough to drop speed,    so let's just kludge it with software!
  1222. +    ****** THE 4X SPEED MITSUMI DRIVES HAVE THE SAME PROBLEM!!!!!! ******
  1223. +    Anyone want to "DONATE" one to me?! ;) I hear sometimes they are
  1224. +    even WORSE! ;)
  1225. +    ** HINT... HINT... TAKE NOTES MITSUMI This could save some hassels with
  1226. +    certain "large" CD's that have data on the outside edge in your 
  1227. +    DOS DRIVERS .... Accuracy counts... speed is secondary ;)
  1228. +    17 June 95 Modifications By Andrew J. Kroll <ag784@freenet.buffalo.edu>
  1229. +    07 July 1995 Modifications by Andrew J. Kroll
  1230. +
  1231.  */
  1232.  
  1233.  #include <linux/config.h>
  1234. @@ -82,6 +101,24 @@
  1235.  static int mcd_sizes[] = { 0 };
  1236.  #endif
  1237.  
  1238. +/* I know putting defines in this file is probably stupid, but it should be */
  1239. +/* the only place that they are really needed... I HOPE! :) */
  1240. +
  1241. +/* How many sectors to read at 1x when an error at 2x speed occurs. */
  1242. +/* You can change this to anything from 2 to 32767, but 30 seems to */
  1243. +/* work best for me.  I have found that when the drive has problems */
  1244. +/* reading one sector, it will have troubles reading the next few.  */
  1245. +#define SINGLE_HOLD_SECTORS 30    
  1246. +
  1247. +#define MCMD_2X_READ 0xC1    /* Double Speed Read DON'T TOUCH! */
  1248. +
  1249. +/* I added A flag to drop to 1x speed if too many errors 0 = 1X ; 1 = 2X */
  1250. +static int mcdDouble = 0; 
  1251. +
  1252. +/* How many sectors to hold at 1x speed counter */
  1253. +static int mcd1xhold = 0;
  1254. +
  1255. +/* Is the drive connected properly and responding?? */
  1256.  static int mcdPresent = 0;
  1257.  
  1258.  #if 0
  1259. @@ -667,35 +704,71 @@
  1260.    int st;
  1261.  
  1262.  
  1263. -  if (mcd_error) {
  1264. -    if (mcd_error & 0xA5) {
  1265. +  if (mcd_error) 
  1266. +  {
  1267. +    if (mcd_error & 0xA5) 
  1268. +    {
  1269.        printk("mcd: I/O error 0x%02x", mcd_error);
  1270.        if (mcd_error & 0x80)
  1271.      printk(" (Door open)");
  1272.        if (mcd_error & 0x20)
  1273.      printk(" (Disk changed)");
  1274.        if (mcd_error & 0x04)
  1275. -    printk(" (Read error)");
  1276. +    {
  1277. +    printk(" (Read error)"); /* Bitch about the problem. */
  1278. +    
  1279. +    /* Time to get fancy! If at 2x speed and 1 error, drop to 1x speed! */
  1280. +    /* Interesting how it STAYS at MCD_RETRY_ATTEMPTS on first error! */
  1281. +    /* But I find that rather HANDY!!! */
  1282. +    /* Neat! it REALLY WORKS on those LOW QUALITY CD's!!! Smile! :) */
  1283. +    /* AJK [06/17/95] */
  1284. +    
  1285. +    /* Slap the CD down to single speed! */
  1286. +    if (mcdDouble == 1 && McdTries == MCD_RETRY_ATTEMPTS && MCMD_DATA_READ == MCMD_2X_READ) 
  1287. +        {
  1288. +        MCMD_DATA_READ = MCMD_PLAY_READ; /* Uhhh, Ummmm, muhuh-huh! */
  1289. +        mcd1xhold = SINGLE_HOLD_SECTORS; /* Hey Bevis! */
  1290. +        printk(" Speed now 1x");     /* Pull my finger! */
  1291. +        }
  1292. +    }
  1293.        printk("\n");
  1294.        mcd_invalidate_buffers();
  1295.  #ifdef WARN_IF_READ_FAILURE
  1296. -      if (McdTries == 5)
  1297. +      if (McdTries == MCD_RETRY_ATTEMPTS)
  1298.      printk("mcd: read of block %d failed\n", mcd_next_bn);
  1299.  #endif
  1300. -      if (!McdTries--) {
  1301. +      if (!McdTries--) 
  1302. +        {
  1303. +    /* Nuts! This cd is ready for recycling! */
  1304. +    /* When WAS the last time YOU cleaned it CORRECTLY?! */
  1305.      printk("mcd: read of block %d failed, giving up\n", mcd_next_bn);
  1306. -    if (mcd_transfer_is_active) {
  1307. +    if (mcd_transfer_is_active) 
  1308. +    {
  1309.        McdTries = 0;
  1310.        goto ret;
  1311.      }
  1312.      if (CURRENT_VALID)
  1313.        end_request(0);
  1314. -    McdTries = 5;
  1315. +    McdTries = MCD_RETRY_ATTEMPTS;
  1316.        }
  1317.      }
  1318.      mcd_error = 0;
  1319.      mcd_state = MCD_S_STOP;
  1320.    }
  1321. +    /* Switch back to Double speed if enough GOOD sectors were read! */
  1322. +    
  1323. +    /* Are we a double speed with a crappy CD?! */
  1324. +    if (mcdDouble == 1 && McdTries == MCD_RETRY_ATTEMPTS && MCMD_DATA_READ == MCMD_PLAY_READ)
  1325. +        {
  1326. +    /* We ARE a double speed and we ARE bitching! */
  1327. +    if (mcd1xhold == 0) /* Okay, Like are we STILL at single speed? */
  1328. +        { /* We need to switch back to double speed now... */
  1329. +        MCMD_DATA_READ = MCMD_2X_READ; /* Uhhh... BACK You GO! */
  1330. +        printk("mcd: Switching back to 2X speed!\n"); /* Tell 'em! */
  1331. +        }
  1332. +    else mcd1xhold--; /* No?! Count down the good reads some more... */
  1333. +                /* and try, try again! */
  1334. +        }
  1335.  
  1336.  
  1337.  
  1338. @@ -1183,10 +1256,16 @@
  1339.  #else
  1340.                  return -EIO;
  1341.  #endif
  1342. -    printk("Mitsumi status, type and version : %02X %c %x\n",
  1343. +    printk("Mitsumi status, type and version : %02X %c %x ",
  1344.             result[0],result[1],result[2]);
  1345.  
  1346. -    if (result[1] == 'D') MCMD_DATA_READ= 0xC1;
  1347. +     if (result[1] == 'D') 
  1348. +    {
  1349. +    printk("Double Speed CD ROM\n");
  1350. +    MCMD_DATA_READ = MCMD_2X_READ;
  1351. +        mcdDouble = 1; /* Added flag to drop to 1x speed if too many errors */
  1352. +        }
  1353. +       else printk("Single Speed CD ROM\n");
  1354.  
  1355.      mcdVersion=result[2];
  1356.  
  1357. diff -u --recursive --new-file v1.3.11/linux/drivers/char/Makefile linux/drivers/char/Makefile
  1358. --- v1.3.11/linux/drivers/char/Makefile    Tue Jul 11 10:02:49 1995
  1359. +++ linux/drivers/char/Makefile    Thu Jul 20 09:19:46 1995
  1360. @@ -83,7 +83,7 @@
  1361.  endif
  1362.   
  1363.  
  1364. -all: char.a
  1365. +all: uni_hash_tbl.h char.a
  1366.  
  1367.  char.a: $(OBJS)
  1368.      $(AR) rcs char.a $(OBJS)
  1369. diff -u --recursive --new-file v1.3.11/linux/drivers/net/de4x5.c linux/drivers/net/de4x5.c
  1370. --- v1.3.11/linux/drivers/net/de4x5.c    Fri Jul  7 08:54:47 1995
  1371. +++ linux/drivers/net/de4x5.c    Mon Jul 24 17:38:25 1995
  1372. @@ -213,7 +213,7 @@
  1373.  #define MIN_DAT_SZ       1               /* Minimum ethernet data length */
  1374.  #define PKT_HDR_LEN     14              /* Addresses and data length info */
  1375.  #define FAKE_FRAME_LEN  (MAX_PKT_SZ + 1)
  1376. -#define QUEUE_PKT_TIMEOUT (300)         /* Jiffies */
  1377. +#define QUEUE_PKT_TIMEOUT (3*HZ)        /* 3 second timeout */
  1378.  
  1379.  
  1380.  #define CRC_POLYNOMIAL_BE 0x04c11db7UL   /* Ethernet CRC, big endian */
  1381. @@ -916,7 +916,7 @@
  1382.    outl(omr|OMR_ST, DE4X5_OMR);
  1383.  
  1384.    /* Poll for completion of setup frame (interrupts are disabled for now) */
  1385. -  for (j=0, i=jiffies;(i==jiffies) && (j==0);) {
  1386. +  for (j=0, i=jiffies;(i<=jiffies+HZ/100) && (j==0);) {
  1387.      if (lp->tx_ring[lp->tx_new].status >= 0) j=1;
  1388.    }
  1389.    outl(omr, DE4X5_OMR);                        /* Stop everything! */
  1390. @@ -973,7 +973,7 @@
  1391.        status = -1;
  1392.      } else {
  1393.        if (de4x5_debug >= 1) {
  1394. -    printk("%s: transmit timed out, status %08x, tbusy:%d, lostMedia:%d tickssofar:%ld, resetting.\n",dev->name, inl(DE4X5_STS), dev->tbusy, lp->lostMedia, tickssofar);
  1395. +    printk("%s: transmit timed out, status %08x, tbusy:%ld, lostMedia:%d tickssofar:%ld, resetting.\n",dev->name, inl(DE4X5_STS), dev->tbusy, lp->lostMedia, tickssofar);
  1396.        }
  1397.  
  1398.        /* Stop and reset the TX and RX... */
  1399. diff -u --recursive --new-file v1.3.11/linux/drivers/net/depca.c linux/drivers/net/depca.c
  1400. --- v1.3.11/linux/drivers/net/depca.c    Fri Jul  7 08:54:47 1995
  1401. +++ linux/drivers/net/depca.c    Mon Jul 24 17:38:25 1995
  1402. @@ -817,7 +817,7 @@
  1403.    /* Transmitter timeout, serious problems. */
  1404.    if (dev->tbusy) {
  1405.      int tickssofar = jiffies - dev->trans_start;
  1406. -    if (tickssofar < 100) {
  1407. +    if (tickssofar < 1*HZ) {
  1408.        status = -1;
  1409.      } else {
  1410.        printk("%s: transmit timed out, status %04x, resetting.\n",
  1411. diff -u --recursive --new-file v1.3.11/linux/drivers/net/loopback.c linux/drivers/net/loopback.c
  1412. --- v1.3.11/linux/drivers/net/loopback.c    Thu Jul 13 16:20:20 1995
  1413. +++ linux/drivers/net/loopback.c    Wed Jul 19 14:36:46 1995
  1414. @@ -101,6 +101,7 @@
  1415.      restore_flags(flags);
  1416.    
  1417.      stats->tx_packets++;
  1418. +    stats->rx_packets++;
  1419.  
  1420.      dev->tbusy = 0;
  1421.  
  1422. diff -u --recursive --new-file v1.3.11/linux/drivers/net/slhc.c linux/drivers/net/slhc.c
  1423. --- v1.3.11/linux/drivers/net/slhc.c    Tue Jun  6 12:23:16 1995
  1424. +++ linux/drivers/net/slhc.c    Tue Jul 25 10:10:10 1995
  1425. @@ -615,8 +615,8 @@
  1426.      cp += 20;
  1427.  
  1428.      if (ip->ihl > 5) {
  1429. -      memcpy(cp, cs->cs_ipopt, ((ip->ihl) - 5) * 4);
  1430. -      cp += ((ip->ihl) - 5) * 4;
  1431. +      memcpy(cp, cs->cs_ipopt, (ip->ihl - 5) * 4);
  1432. +      cp += (ip->ihl - 5) * 4;
  1433.      }
  1434.  
  1435.      ((struct iphdr *)icp)->check = ip_fast_csum(icp, ((struct iphdr*)icp)->ihl);
  1436. @@ -640,9 +640,7 @@
  1437.  slhc_remember(struct slcompress *comp, unsigned char *icp, int isize)
  1438.  {
  1439.      register struct cstate *cs;
  1440. -    short ip_len;
  1441. -    struct iphdr *ip;
  1442. -    struct tcphdr *thp;
  1443. +    unsigned ihl;
  1444.  
  1445.      unsigned char index;
  1446.  
  1447. @@ -651,23 +649,21 @@
  1448.          comp->sls_i_runt++;
  1449.          return slhc_toss( comp );
  1450.      }
  1451. -    /* Sneak a peek at the IP header's IHL field to find its length */
  1452. -    ip_len = (icp[0] & 0xf) << 2;
  1453. -    if(ip_len < 20){
  1454. +    /* Peek at the IP header's IHL field to find its length */
  1455. +    ihl = icp[0] & 0xf;
  1456. +    if(ihl < 20 / 4){
  1457.          /* The IP header length field is too small */
  1458.          comp->sls_i_runt++;
  1459.          return slhc_toss( comp );
  1460.      }
  1461.      index = icp[9];
  1462.      icp[9] = IPPROTO_TCP;
  1463. -    ip = (struct iphdr *) icp;
  1464.  
  1465. -    if (ip_fast_csum(icp, ip->ihl)) {
  1466. +    if (ip_fast_csum(icp, ihl)) {
  1467.          /* Bad IP header checksum; discard */
  1468.          comp->sls_i_badcheck++;
  1469.          return slhc_toss( comp );
  1470.      }
  1471. -    thp = (struct tcphdr *)(((unsigned char *)ip) + ip->ihl*4);
  1472.      if(index > comp->rslot_limit) {
  1473.          comp->sls_i_error++;
  1474.          return slhc_toss(comp);
  1475. @@ -676,13 +672,13 @@
  1476.      /* Update local state */
  1477.      cs = &comp->rstate[comp->recv_current = index];
  1478.      comp->flags &=~ SLF_TOSS;
  1479. -    memcpy(&cs->cs_ip,ip,20);
  1480. -    memcpy(&cs->cs_tcp,thp,20);
  1481. -    if (ip->ihl > 5)
  1482. -      memcpy(cs->cs_ipopt, ip+1, ((ip->ihl) - 5) * 4);
  1483. -    if (thp->doff > 5)
  1484. -      memcpy(cs->cs_tcpopt, thp+1, ((thp->doff) - 5) * 4);
  1485. -    cs->cs_hsize = ip->ihl*2 + thp->doff*2;
  1486. +    memcpy(&cs->cs_ip,icp,20);
  1487. +    memcpy(&cs->cs_tcp,icp + ihl*4,20);
  1488. +    if (ihl > 5)
  1489. +      memcpy(cs->cs_ipopt, icp + sizeof(struct iphdr), (ihl - 5) * 4);
  1490. +    if (cs->cs_tcp.doff > 5)
  1491. +      memcpy(cs->cs_tcpopt, icp + ihl*4 + sizeof(struct tcphdr), (cs->cs_tcp.doff - 5) * 4);
  1492. +    cs->cs_hsize = ihl*2 + cs->cs_tcp.doff*2;
  1493.      /* Put headers back on packet
  1494.       * Neither header checksum is recalculated
  1495.       */
  1496. diff -u --recursive --new-file v1.3.11/linux/drivers/scsi/Makefile linux/drivers/scsi/Makefile
  1497. --- v1.3.11/linux/drivers/scsi/Makefile    Tue Jul 11 10:02:50 1995
  1498. +++ linux/drivers/scsi/Makefile    Tue Jul 25 09:57:14 1995
  1499. @@ -11,8 +11,10 @@
  1500.  .c.o:
  1501.      $(CC) $(CFLAGS) -c $<
  1502.  
  1503. +ifdef CONFIG_KERNEL_ELF
  1504.  # This is used for ELF - it needs to migrate or be moved.
  1505.  LD_RFLAG = -m elf_i386
  1506. +endif
  1507.  
  1508.  AHA152X    = -DDEBUG_AHA152X -DAUTOCONF -DSKIP_BIOSTEST -DIRQ=11
  1509.  
  1510. diff -u --recursive --new-file v1.3.11/linux/drivers/scsi/aic7xxx.c linux/drivers/scsi/aic7xxx.c
  1511. --- v1.3.11/linux/drivers/scsi/aic7xxx.c    Tue Jul 18 16:28:57 1995
  1512. +++ linux/drivers/scsi/aic7xxx.c    Thu Jul 20 09:11:45 1995
  1513. @@ -18,9 +18,6 @@
  1514.   * along with this program; see the file COPYING.  If not, write to
  1515.   * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  1516.   *
  1517. - * An alternate version of this driver with a BSD-style copyright can
  1518. - * be found on XXX.
  1519. - *
  1520.   * Sources include the Adaptec 1740 driver (aha1740.c), the Ultrastor 24F
  1521.   * driver (ultrastor.c), various Linux kernel source, the Adaptec EISA
  1522.   * config file (!adp7771.cfg), the Adaptec AHA-2740A Series User's Guide,
  1523. diff -u --recursive --new-file v1.3.11/linux/drivers/scsi/aic7xxx.h linux/drivers/scsi/aic7xxx.h
  1524. --- v1.3.11/linux/drivers/scsi/aic7xxx.h    Tue Jul 18 16:28:57 1995
  1525. +++ linux/drivers/scsi/aic7xxx.h    Thu Jul 20 09:11:45 1995
  1526. @@ -18,9 +18,6 @@
  1527.   * along with this program; see the file COPYING.  If not, write to
  1528.   * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  1529.   * 
  1530. - * An alternate version of this driver with a BSD-style copyright can
  1531. - * be found on XXX.    
  1532. - *
  1533.   * $Id: aic7xxx.h,v 1.18 1995/06/22 04:17:56 deang Exp $
  1534.   *-M*************************************************************************/
  1535.  #ifndef _aic7xxx_h
  1536. diff -u --recursive --new-file v1.3.11/linux/drivers/scsi/aic7xxx_asm.c linux/drivers/scsi/aic7xxx_asm.c
  1537. --- v1.3.11/linux/drivers/scsi/aic7xxx_asm.c    Tue Jul 18 16:28:58 1995
  1538. +++ linux/drivers/scsi/aic7xxx_asm.c    Thu Jul 20 09:11:45 1995
  1539. @@ -18,9 +18,6 @@
  1540.   * along with this program; see the file COPYING.  If not, write to
  1541.   * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  1542.   *
  1543. - * An alternate version of this driver with a BSD-style copyright can
  1544. - * be found on XXX.    
  1545. - *
  1546.   * Comments are started by `#' and continue to the end of the line; lines
  1547.   * may be of the form:
  1548.   *      <label>*
  1549. diff -u --recursive --new-file v1.3.11/linux/drivers/scsi/scsi.c linux/drivers/scsi/scsi.c
  1550. --- v1.3.11/linux/drivers/scsi/scsi.c    Tue Jul 11 10:02:50 1995
  1551. +++ linux/drivers/scsi/scsi.c    Tue Jul 25 08:53:44 1995
  1552. @@ -757,7 +757,7 @@
  1553.      if(SDpnt != NULL)
  1554.      scsi_init_free((char *) SDpnt, sizeof(Scsi_Device));
  1555.      
  1556. -    if(SDpnt != NULL)
  1557. +    if(SCpnt != NULL)
  1558.      scsi_init_free((char *) SCpnt, sizeof(Scsi_Cmnd));
  1559.      
  1560.      /* If we allocated a buffer so we could do DMA, free it now */
  1561. diff -u --recursive --new-file v1.3.11/linux/drivers/scsi/sg.c linux/drivers/scsi/sg.c
  1562. --- v1.3.11/linux/drivers/scsi/sg.c    Tue Jul 11 10:02:51 1995
  1563. +++ linux/drivers/scsi/sg.c    Tue Jul 25 09:57:14 1995
  1564. @@ -167,7 +167,7 @@
  1565.      if (size<=4096)
  1566.      return (char *) scsi_malloc(size);
  1567.  #ifdef SG_BIG_BUFF
  1568. -    if (size<SG_BIG_BUFF)
  1569. +    if (size<=SG_BIG_BUFF)
  1570.      {
  1571.      while(big_inuse)
  1572.      {
  1573. diff -u --recursive --new-file v1.3.11/linux/drivers/sound/pas2_midi.c linux/drivers/sound/pas2_midi.c
  1574. --- v1.3.11/linux/drivers/sound/pas2_midi.c    Tue Jul 11 10:02:53 1995
  1575. +++ linux/drivers/sound/pas2_midi.c    Wed Jul 19 07:56:51 1995
  1576. @@ -33,7 +33,7 @@
  1577.  
  1578.  #include "pas.h"
  1579.  
  1580. -#if !defined(EXCLUDE_PAS) && !defined(EXCLUDE_MIDI) && defined(EXCLUDE_PRO_MIDI)
  1581. +#if !defined(EXCLUDE_PAS) && !defined(EXCLUDE_MIDI)
  1582.  
  1583.  static int      midi_busy = 0, input_opened = 0;
  1584.  static int      my_dev;
  1585. diff -u --recursive --new-file v1.3.11/linux/include/asm-alpha/io.h linux/include/asm-alpha/io.h
  1586. --- v1.3.11/linux/include/asm-alpha/io.h    Fri Jul  7 08:54:53 1995
  1587. +++ linux/include/asm-alpha/io.h    Mon Jul 24 17:38:25 1995
  1588. @@ -77,7 +77,7 @@
  1589.  # define outl(l,p) _outl((l),(p))
  1590.  #endif
  1591.  
  1592. -#endif /* __KERNEL__ */
  1593. +#endif /* !__KERNEL__ */
  1594.  
  1595.  /*
  1596.   * There are different version of the alpha motherboards: the
  1597. @@ -90,6 +90,8 @@
  1598.  #include <asm/jensen.h>
  1599.  #endif
  1600.  
  1601. +#ifdef __KERNEL__
  1602. +
  1603.  /*
  1604.   * String version of IO memory access ops:
  1605.   */
  1606. @@ -122,5 +124,7 @@
  1607.  #define memset_io(addr,c,len)        (memset_io)((unsigned long)(addr),(c),(len))
  1608.  #define memcpy_fromio(to,from,len)    (memcpy_fromio)((to),(unsigned long)(from),(len))
  1609.  #define memcpy_toio(to,from,len)    (memcpy_toio)((unsigned long)(to),(from),(len))
  1610. +
  1611. +#endif /* __KERNEL__ */
  1612.  
  1613.  #endif
  1614. diff -u --recursive --new-file v1.3.11/linux/include/asm-alpha/mman.h linux/include/asm-alpha/mman.h
  1615. --- v1.3.11/linux/include/asm-alpha/mman.h    Thu Jan  1 02:00:00 1970
  1616. +++ linux/include/asm-alpha/mman.h    Tue Jul 25 10:35:56 1995
  1617. @@ -0,0 +1,29 @@
  1618. +#ifndef __ALPHA_MMAN_H__
  1619. +#define __ALPHA_MMAN_H__
  1620. +
  1621. +#define PROT_READ    0x1        /* page can be read */
  1622. +#define PROT_WRITE    0x2        /* page can be written */
  1623. +#define PROT_EXEC    0x4        /* page can be executed */
  1624. +#define PROT_NONE    0x0        /* page can not be accessed */
  1625. +
  1626. +#define MAP_SHARED    0x01        /* Share changes */
  1627. +#define MAP_PRIVATE    0x02        /* Changes are private */
  1628. +#define MAP_TYPE    0x0f        /* Mask for type of mapping (OSF/1 is _wrong_) */
  1629. +#define MAP_FIXED    0x100        /* Interpret addr exactly */
  1630. +#define MAP_ANONYMOUS    0x10        /* don't use a file */
  1631. +
  1632. +/* not used by linux, but here to make sure we don't clash with OSF/1 defines */
  1633. +#define MAP_HASSEMAPHORE 0x0200
  1634. +#define MAP_INHERIT    0x0400
  1635. +#define MAP_UNALIGNED    0x0800
  1636. +
  1637. +/* These are linux-specific */
  1638. +#define MAP_GROWSDOWN    0x1000        /* stack-like segment */
  1639. +#define MAP_DENYWRITE    0x2000        /* ETXTBSY */
  1640. +#define MAP_EXECUTABLE    0x4000        /* mark it as a executable */
  1641. +
  1642. +#define MS_ASYNC    1        /* sync memory asynchronously */
  1643. +#define MS_SYNC        2        /* synchronous memory sync */
  1644. +#define MS_INVALIDATE    4        /* invalidate the caches */
  1645. +
  1646. +#endif /* __ALPHA_MMAN_H__ */
  1647. diff -u --recursive --new-file v1.3.11/linux/include/asm-alpha/sigcontext.h linux/include/asm-alpha/sigcontext.h
  1648. --- v1.3.11/linux/include/asm-alpha/sigcontext.h    Thu Jan  1 02:00:00 1970
  1649. +++ linux/include/asm-alpha/sigcontext.h    Thu Jul 20 09:14:32 1995
  1650. @@ -0,0 +1,34 @@
  1651. +#ifndef _ASMAXP_SIGCONTEXT_H
  1652. +#define _ASMAXP_SIGCONTEXT_H
  1653. +
  1654. +struct sigcontext_struct {
  1655. +    /*
  1656. +     * what should we have here? I'd probably better use the same
  1657. +     * stack layout as OSF/1, just in case we ever want to try
  1658. +     * running their binaries.. 
  1659. +     *
  1660. +     * This is the basic layout, but I don't know if we'll ever
  1661. +     * actually fill in all the values..
  1662. +     */
  1663. +     long        sc_onstack;
  1664. +     long        sc_mask;
  1665. +     long        sc_pc;
  1666. +     long        sc_ps;
  1667. +     long        sc_regs[32];
  1668. +     long        sc_ownedfp;
  1669. +     long        sc_fpregs[32];
  1670. +     unsigned long    sc_fpcr;
  1671. +     unsigned long    sc_fp_control;
  1672. +     unsigned long    sc_reserved1, sc_reserved2;
  1673. +     unsigned long    sc_ssize;
  1674. +     char *        sc_sbase;
  1675. +     unsigned long    sc_traparg_a0;
  1676. +     unsigned long    sc_traparg_a1;
  1677. +     unsigned long    sc_traparg_a2;
  1678. +     unsigned long    sc_fp_trap_pc;
  1679. +     unsigned long    sc_fp_trigger_sum;
  1680. +     unsigned long    sc_fp_trigger_inst;
  1681. +     unsigned long    sc_retcode[2];
  1682. +};
  1683. +
  1684. +#endif
  1685. diff -u --recursive --new-file v1.3.11/linux/include/asm-alpha/signal.h linux/include/asm-alpha/signal.h
  1686. --- v1.3.11/linux/include/asm-alpha/signal.h    Fri Jun  2 13:51:17 1995
  1687. +++ linux/include/asm-alpha/signal.h    Thu Jul 20 09:14:32 1995
  1688. @@ -78,37 +78,7 @@
  1689.  };
  1690.  
  1691.  #ifdef __KERNEL__
  1692. -
  1693. -struct sigcontext_struct {
  1694. -    /*
  1695. -     * what should we have here? I'd probably better use the same
  1696. -     * stack layout as OSF/1, just in case we ever want to try
  1697. -     * running their binaries.. 
  1698. -     *
  1699. -     * This is the basic layout, but I don't know if we'll ever
  1700. -     * actually fill in all the values..
  1701. -     */
  1702. -     long        sc_onstack;
  1703. -     long        sc_mask;
  1704. -     long        sc_pc;
  1705. -     long        sc_ps;
  1706. -     long        sc_regs[32];
  1707. -     long        sc_ownedfp;
  1708. -     long        sc_fpregs[32];
  1709. -     unsigned long    sc_fpcr;
  1710. -     unsigned long    sc_fp_control;
  1711. -     unsigned long    sc_reserved1, sc_reserved2;
  1712. -     unsigned long    sc_ssize;
  1713. -     char *        sc_sbase;
  1714. -     unsigned long    sc_traparg_a0;
  1715. -     unsigned long    sc_traparg_a1;
  1716. -     unsigned long    sc_traparg_a2;
  1717. -     unsigned long    sc_fp_trap_pc;
  1718. -     unsigned long    sc_fp_trigger_sum;
  1719. -     unsigned long    sc_fp_trigger_inst;
  1720. -     unsigned long    sc_retcode[2];
  1721. -};
  1722. -
  1723. +#include <asm/sigcontext.h>
  1724.  #endif
  1725.  
  1726.  #endif
  1727. diff -u --recursive --new-file v1.3.11/linux/include/asm-alpha/string.h linux/include/asm-alpha/string.h
  1728. --- v1.3.11/linux/include/asm-alpha/string.h    Fri Jul  7 08:54:53 1995
  1729. +++ linux/include/asm-alpha/string.h    Thu Jul 20 09:42:29 1995
  1730. @@ -5,11 +5,12 @@
  1731.  extern void * __memset(void *, char, size_t);
  1732.  extern void * __memcpy(void *, const void *, size_t);
  1733.  
  1734. +#define __HAVE_ARCH_MEMSET
  1735.  #define memset(s, c, count) \
  1736.  (__builtin_constant_p(c) ? \
  1737.   __constant_c_memset((s),(0x0101010101010101UL*(unsigned char)c),(count)) : \
  1738.   __memset((s),(c),(count)))
  1739.  
  1740. -#define memcpy(d,s,count) __memcpy((d),(s),(count))
  1741. +#define __HAVE_ARCH_STRLEN
  1742.  
  1743.  #endif
  1744. diff -u --recursive --new-file v1.3.11/linux/include/asm-alpha/system.h linux/include/asm-alpha/system.h
  1745. --- v1.3.11/linux/include/asm-alpha/system.h    Tue Jul 18 16:28:58 1995
  1746. +++ linux/include/asm-alpha/system.h    Wed Jul 19 09:24:54 1995
  1747. @@ -118,6 +118,16 @@
  1748.  #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
  1749.  #define tas(ptr) (xchg((ptr),1))
  1750.  
  1751. +/*
  1752. + * This function doesn't exist, so you'll get a linker error
  1753. + * if something tries to do an invalid xchg().
  1754. + *
  1755. + * This only works if the compiler isn't horribly bad at optimizing.
  1756. + * gcc-2.5.8 reportedly can't handle this, but as that doesn't work
  1757. + * too well on the alpha anyway..
  1758. + */
  1759. +extern void __xchg_called_with_bad_pointer(void);
  1760. +
  1761.  static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size)
  1762.  {
  1763.      switch (size) {
  1764. @@ -126,7 +136,7 @@
  1765.          case 8:
  1766.              return xchg_u64(ptr, x);
  1767.      }
  1768. -    printk("Argh.. xchg() with unsupported size\n");
  1769. +    __xchg_called_with_bad_pointer();
  1770.      return x;
  1771.  }
  1772.  
  1773. diff -u --recursive --new-file v1.3.11/linux/include/asm-alpha/unistd.h linux/include/asm-alpha/unistd.h
  1774. --- v1.3.11/linux/include/asm-alpha/unistd.h    Tue Jul 18 16:28:58 1995
  1775. +++ linux/include/asm-alpha/unistd.h    Wed Jul 19 09:26:21 1995
  1776. @@ -50,7 +50,7 @@
  1777.  #define __NR_vhangup         76
  1778.  #define __NR_getgroups         79
  1779.  #define __NR_setgroups         80
  1780. -#define __NR_setpgid         82
  1781. +#define __NR_setpgrp         82
  1782.  #define __NR_setitimer         83
  1783.  #define __NR_getitimer         86
  1784.  #define __NR_gethostname     87
  1785. diff -u --recursive --new-file v1.3.11/linux/include/asm-i386/mman.h linux/include/asm-i386/mman.h
  1786. --- v1.3.11/linux/include/asm-i386/mman.h    Thu Jan  1 02:00:00 1970
  1787. +++ linux/include/asm-i386/mman.h    Mon Jul 24 17:42:13 1995
  1788. @@ -0,0 +1,23 @@
  1789. +#ifndef __I386_MMAN_H__
  1790. +#define __I386_MMAN_H__
  1791. +
  1792. +#define PROT_READ    0x1        /* page can be read */
  1793. +#define PROT_WRITE    0x2        /* page can be written */
  1794. +#define PROT_EXEC    0x4        /* page can be executed */
  1795. +#define PROT_NONE    0x0        /* page can not be accessed */
  1796. +
  1797. +#define MAP_SHARED    0x01        /* Share changes */
  1798. +#define MAP_PRIVATE    0x02        /* Changes are private */
  1799. +#define MAP_TYPE    0x0f        /* Mask for type of mapping */
  1800. +#define MAP_FIXED    0x10        /* Interpret addr exactly */
  1801. +#define MAP_ANONYMOUS    0x20        /* don't use a file */
  1802. +
  1803. +#define MAP_GROWSDOWN    0x0100        /* stack-like segment */
  1804. +#define MAP_DENYWRITE    0x0800        /* ETXTBSY */
  1805. +#define MAP_EXECUTABLE    0x1000        /* mark it as a executable */
  1806. +
  1807. +#define MS_ASYNC    1        /* sync memory asynchronously */
  1808. +#define MS_INVALIDATE    2        /* invalidate the caches */
  1809. +#define MS_SYNC        4        /* synchronous memory sync */
  1810. +
  1811. +#endif /* __I386_MMAN_H__ */
  1812. diff -u --recursive --new-file v1.3.11/linux/include/asm-i386/sigcontext.h linux/include/asm-i386/sigcontext.h
  1813. --- v1.3.11/linux/include/asm-i386/sigcontext.h    Thu Jan  1 02:00:00 1970
  1814. +++ linux/include/asm-i386/sigcontext.h    Thu Jul 20 09:13:26 1995
  1815. @@ -0,0 +1,29 @@
  1816. +#ifndef _ASMi386_SIGCONTEXT_H
  1817. +#define _ASMi386_SIGCONTEXT_H
  1818. +
  1819. +struct sigcontext_struct {
  1820. +    unsigned short gs, __gsh;
  1821. +    unsigned short fs, __fsh;
  1822. +    unsigned short es, __esh;
  1823. +    unsigned short ds, __dsh;
  1824. +    unsigned long edi;
  1825. +    unsigned long esi;
  1826. +    unsigned long ebp;
  1827. +    unsigned long esp;
  1828. +    unsigned long ebx;
  1829. +    unsigned long edx;
  1830. +    unsigned long ecx;
  1831. +    unsigned long eax;
  1832. +    unsigned long trapno;
  1833. +    unsigned long err;
  1834. +    unsigned long eip;
  1835. +    unsigned short cs, __csh;
  1836. +    unsigned long eflags;
  1837. +    unsigned long esp_at_signal;
  1838. +    unsigned short ss, __ssh;
  1839. +    unsigned long i387;
  1840. +    unsigned long oldmask;
  1841. +    unsigned long cr2;
  1842. +};
  1843. +
  1844. +#endif
  1845. diff -u --recursive --new-file v1.3.11/linux/include/asm-i386/signal.h linux/include/asm-i386/signal.h
  1846. --- v1.3.11/linux/include/asm-i386/signal.h    Sat Jun 10 18:35:54 1995
  1847. +++ linux/include/asm-i386/signal.h    Thu Jul 20 09:13:26 1995
  1848. @@ -77,32 +77,7 @@
  1849.  };
  1850.  
  1851.  #ifdef __KERNEL__
  1852. -
  1853. -struct sigcontext_struct {
  1854. -    unsigned short gs, __gsh;
  1855. -    unsigned short fs, __fsh;
  1856. -    unsigned short es, __esh;
  1857. -    unsigned short ds, __dsh;
  1858. -    unsigned long edi;
  1859. -    unsigned long esi;
  1860. -    unsigned long ebp;
  1861. -    unsigned long esp;
  1862. -    unsigned long ebx;
  1863. -    unsigned long edx;
  1864. -    unsigned long ecx;
  1865. -    unsigned long eax;
  1866. -    unsigned long trapno;
  1867. -    unsigned long err;
  1868. -    unsigned long eip;
  1869. -    unsigned short cs, __csh;
  1870. -    unsigned long eflags;
  1871. -    unsigned long esp_at_signal;
  1872. -    unsigned short ss, __ssh;
  1873. -    unsigned long i387;
  1874. -    unsigned long oldmask;
  1875. -    unsigned long cr2;
  1876. -};
  1877. -
  1878. +#include <asm/sigcontext.h>
  1879.  #endif
  1880.  
  1881.  #endif
  1882. diff -u --recursive --new-file v1.3.11/linux/include/asm-i386/string.h linux/include/asm-i386/string.h
  1883. --- v1.3.11/linux/include/asm-i386/string.h    Fri Jul  7 08:54:53 1995
  1884. +++ linux/include/asm-i386/string.h    Thu Jul 20 09:50:29 1995
  1885. @@ -12,7 +12,8 @@
  1886.   *
  1887.   *        Copyright (C) 1991, 1992 Linus Torvalds
  1888.   */
  1889. +
  1890. +#define __HAVE_ARCH_STRCPY
  1891.  extern inline char * strcpy(char * dest,const char *src)
  1892.  {
  1893.  __asm__ __volatile__(
  1894. @@ -26,6 +27,7 @@
  1895.  return dest;
  1896.  }
  1897.  
  1898. +#define __HAVE_ARCH_STRNCPY
  1899.  extern inline char * strncpy(char * dest,const char *src,size_t count)
  1900.  {
  1901.  __asm__ __volatile__(
  1902. @@ -44,6 +46,7 @@
  1903.  return dest;
  1904.  }
  1905.  
  1906. +#define __HAVE_ARCH_STRCAT
  1907.  extern inline char * strcat(char * dest,const char * src)
  1908.  {
  1909.  __asm__ __volatile__(
  1910. @@ -60,6 +63,7 @@
  1911.  return dest;
  1912.  }
  1913.  
  1914. +#define __HAVE_ARCH_STRNCAT
  1915.  extern inline char * strncat(char * dest,const char * src,size_t count)
  1916.  {
  1917.  __asm__ __volatile__(
  1918. @@ -82,6 +86,7 @@
  1919.  return dest;
  1920.  }
  1921.  
  1922. +#define __HAVE_ARCH_STRCMP
  1923.  extern inline int strcmp(const char * cs,const char * ct)
  1924.  {
  1925.  register int __res;
  1926. @@ -101,6 +106,7 @@
  1927.  return __res;
  1928.  }
  1929.  
  1930. +#define __HAVE_ARCH_STRNCMP
  1931.  extern inline int strncmp(const char * cs,const char * ct,size_t count)
  1932.  {
  1933.  register int __res;
  1934. @@ -122,6 +128,7 @@
  1935.  return __res;
  1936.  }
  1937.  
  1938. +#define __HAVE_ARCH_STRCHR
  1939.  extern inline char * strchr(const char * s, int c)
  1940.  {
  1941.  register char * __res;
  1942. @@ -140,6 +147,7 @@
  1943.  return __res;
  1944.  }
  1945.  
  1946. +#define __HAVE_ARCH_STRRCHR
  1947.  extern inline char * strrchr(const char * s, int c)
  1948.  {
  1949.  register char * __res;
  1950. @@ -156,6 +164,7 @@
  1951.  return __res;
  1952.  }
  1953.  
  1954. +#define __HAVE_ARCH_STRSPN
  1955.  extern inline size_t strspn(const char * cs, const char * ct)
  1956.  {
  1957.  register char * __res;
  1958. @@ -181,6 +190,7 @@
  1959.  return __res-cs;
  1960.  }
  1961.  
  1962. +#define __HAVE_ARCH_STRCSPN
  1963.  extern inline size_t strcspn(const char * cs, const char * ct)
  1964.  {
  1965.  register char * __res;
  1966. @@ -206,6 +216,7 @@
  1967.  return __res-cs;
  1968.  }
  1969.  
  1970. +#define __HAVE_ARCH_STRPBRK
  1971.  extern inline char * strpbrk(const char * cs,const char * ct)
  1972.  {
  1973.  register char * __res;
  1974. @@ -234,6 +245,7 @@
  1975.  return __res;
  1976.  }
  1977.  
  1978. +#define __HAVE_ARCH_STRSTR
  1979.  extern inline char * strstr(const char * cs,const char * ct)
  1980.  {
  1981.  register char * __res;
  1982. @@ -262,6 +274,7 @@
  1983.  return __res;
  1984.  }
  1985.  
  1986. +#define __HAVE_ARCH_STRLEN
  1987.  extern inline size_t strlen(const char * s)
  1988.  {
  1989.  register int __res;
  1990. @@ -277,6 +290,7 @@
  1991.  
  1992.  extern char * ___strtok;
  1993.  
  1994. +#define __HAVE_ARCH_STRTOK
  1995.  extern inline char * strtok(char * s,const char * ct)
  1996.  {
  1997.  register char * __res;
  1998. @@ -395,11 +409,13 @@
  1999.  #undef COMMON
  2000.  }
  2001.  
  2002. +#define __HAVE_ARCH_MEMCPY
  2003.  #define memcpy(t, f, n) \
  2004.  (__builtin_constant_p(n) ? \
  2005.   __constant_memcpy((t),(f),(n)) : \
  2006.   __memcpy((t),(f),(n)))
  2007.  
  2008. +#define __HAVE_ARCH_MEMMOVE
  2009.  extern inline void * memmove(void * dest,const void * src, size_t n)
  2010.  {
  2011.  if (dest<src)
  2012. @@ -426,6 +442,7 @@
  2013.  
  2014.  #define memcmp __builtin_memcmp
  2015.  
  2016. +#define __HAVE_ARCH_MEMCHR
  2017.  extern inline void * memchr(const void * cs,int c,size_t count)
  2018.  {
  2019.  register void * __res;
  2020. @@ -532,6 +549,7 @@
  2021.   __constant_count_memset((s),(c),(count)) : \
  2022.   __memset_generic((s),(c),(count)))
  2023.  
  2024. +#define __HAVE_ARCH_MEMSET
  2025.  #define memset(s, c, count) \
  2026.  (__builtin_constant_p(c) ? \
  2027.   __constant_c_x_memset((s),(0x01010101UL*(unsigned char)c),(count)) : \
  2028. @@ -540,6 +558,7 @@
  2029.  /*
  2030.   * find the first occurrence of byte 'c', or 1 past the area if none
  2031.   */
  2032. +#define __HAVE_ARCH_MEMSCAN
  2033.  extern inline void * memscan(void * addr, int c, size_t size)
  2034.  {
  2035.      if (!size)
  2036. diff -u --recursive --new-file v1.3.11/linux/include/linux/aztcd.h linux/include/linux/aztcd.h
  2037. --- v1.3.11/linux/include/linux/aztcd.h    Tue Jul 11 10:02:59 1995
  2038. +++ linux/include/linux/aztcd.h    Tue Jul 25 10:17:15 1995
  2039. @@ -1,4 +1,5 @@
  2040. -/* $Id: aztcd.h,v 1.30 1995/07/04 08:28:17 root Exp $
  2041. +/* $Id: aztcd.h,v 1.40 1995/07/15 20:35:01 root Exp root $
  2042. + *
  2043.   * Definitions for a AztechCD268 CD-ROM interface
  2044.   *    Copyright (C) 1994, 1995  Werner Zimmermann
  2045.   *
  2046. @@ -42,11 +43,17 @@
  2047.    don't want the auto-eject feature*/
  2048.  #define AZT_AUTO_EJECT          0
  2049.  
  2050. +/*Set this to 1, if you want multisession support. Be warned, this function has
  2051. +not been tested !!!*/
  2052. +#define AZT_MULTISESSION        0
  2053. +
  2054. +/*Set this to 1, if you want to use incompatible ioctls for reading in raw and
  2055. +  cooked mode */
  2056. +#define AZT_PRIVATE_IOCTLS      1
  2057. +
  2058.  /*---------------------------------------------------------------------------*/
  2059.  /*------------nothing to be configured below this line-----------------------*/
  2060.  
  2061. -/* use incompatible ioctls for reading in raw and cooked mode */
  2062. -#define AZT_PRIVATE_IOCTLS
  2063.  
  2064.  /* Increase this if you get lots of timeouts; if you get kernel panic, replace
  2065.     STEN_LOW_WAIT by STEN_LOW in the source code */
  2066. @@ -108,6 +115,10 @@
  2067.  
  2068.  #define MAX_TRACKS        104
  2069.  
  2070. +#define CD_DATA            0x01
  2071. +#define CD_AUDIO        0x02
  2072. +#define CD_XA                   (CD_DATA|CD_AUDIO)
  2073. +
  2074.  struct msf {
  2075.      unsigned char    min;
  2076.      unsigned char    sec;
  2077. @@ -124,6 +135,9 @@
  2078.      unsigned char    last;
  2079.      struct msf    diskLength;
  2080.      struct msf    firstTrack;
  2081. +        unsigned char   multi;
  2082. +        struct msf      lastTrack;
  2083. +        unsigned char   type;
  2084.  };
  2085.  
  2086.  struct azt_Toc {
  2087. diff -u --recursive --new-file v1.3.11/linux/include/linux/cm206.h linux/include/linux/cm206.h
  2088. --- v1.3.11/linux/include/linux/cm206.h    Fri Jul  7 08:54:53 1995
  2089. +++ linux/include/linux/cm206.h    Wed Jul 19 10:15:42 1995
  2090. @@ -3,20 +3,23 @@
  2091.  */
  2092.  
  2093.  /* First, the cm260 stuff */
  2094. -/* The ports and irq used. If it is not defined, make it variable, 
  2095. -   and initialize them at some reasonable value */
  2096. +/* The ports and irq used. Although CM206_BASE and CM206_IRQ are defined
  2097. +   below, the values are not used unless autoprobing is turned off and 
  2098. +   no LILO boot options or module command line options are given. Change
  2099. +   these values to your own as last resort if autoprobing and options
  2100. +   don't work. */
  2101.  
  2102.  #define CM206_BASE 0x340
  2103.  #define CM206_IRQ 11
  2104.  
  2105. -#define r_data_status (CM206_BASE)
  2106. -#define r_uart_receive (CM206_BASE+0x2)
  2107. -#define r_fifo_output_buffer (CM206_BASE+0x4)
  2108. -#define r_line_status (CM206_BASE+0x6)
  2109. -#define r_data_control (CM206_BASE+0x8)
  2110. -#define r_uart_transmit (CM206_BASE+0xa)
  2111. -#define r_test_clock (CM206_BASE+0xc)
  2112. -#define r_test_control (CM206_BASE+0xe)
  2113. +#define r_data_status (cm206_base)
  2114. +#define r_uart_receive (cm206_base+0x2)
  2115. +#define r_fifo_output_buffer (cm206_base+0x4)
  2116. +#define r_line_status (cm206_base+0x6)
  2117. +#define r_data_control (cm206_base+0x8)
  2118. +#define r_uart_transmit (cm206_base+0xa)
  2119. +#define r_test_clock (cm206_base+0xc)
  2120. +#define r_test_control (cm206_base+0xe)
  2121.  
  2122.  /* the data_status flags */
  2123.  #define ds_ram_size 0x4000
  2124. @@ -123,4 +126,3 @@
  2125.  
  2126.  #define CM206CTL_GET_STAT 0x2000
  2127.  #define CM206CTL_GET_LAST_STAT 0x2001
  2128. -#define CM206_RESET_DRIVE 0x2002 /* use with care */
  2129. diff -u --recursive --new-file v1.3.11/linux/include/linux/if_ppp.h linux/include/linux/if_ppp.h
  2130. --- v1.3.11/linux/include/linux/if_ppp.h    Thu Jul 13 16:20:21 1995
  2131. +++ linux/include/linux/if_ppp.h    Mon Jul 24 17:38:25 1995
  2132. @@ -193,7 +193,7 @@
  2133.    struct tty_struct    *tty;        /* ptr to TTY structure        */
  2134.    struct device        *dev;        /* easy for intr handling    */
  2135.    struct slcompress    *slcomp;    /* for header compression    */
  2136. -  __u32            last_xmit;    /* time of last transmission    */
  2137. +  unsigned long        last_xmit;    /* time of last transmission    */
  2138.  
  2139.    /* These are pointers to the malloc()ed frame buffers.
  2140.       These buffers are used while processing a packet.    If a packet
  2141. diff -u --recursive --new-file v1.3.11/linux/include/linux/mman.h linux/include/linux/mman.h
  2142. --- v1.3.11/linux/include/linux/mman.h    Mon Jan 23 23:04:10 1995
  2143. +++ linux/include/linux/mman.h    Mon Jul 24 17:38:25 1995
  2144. @@ -1,23 +1,6 @@
  2145.  #ifndef _LINUX_MMAN_H
  2146.  #define _LINUX_MMAN_H
  2147.  
  2148. -#define PROT_READ        0x1       /* page can be read */
  2149. -#define PROT_WRITE       0x2       /* page can be written */
  2150. -#define PROT_EXEC        0x4       /* page can be executed */
  2151. -#define PROT_NONE        0x0       /* page can not be accessed */
  2152. -
  2153. -#define MAP_SHARED       1         /* Share changes */
  2154. -#define MAP_PRIVATE      2         /* Changes are private */
  2155. -#define MAP_TYPE         0xf       /* Mask for type of mapping */
  2156. -#define MAP_FIXED        0x10      /* Interpret addr exactly */
  2157. -#define MAP_ANONYMOUS    0x20      /* don't use a file */
  2158. -
  2159. -#define MAP_GROWSDOWN    0x0100        /* stack-like segment */
  2160. -#define MAP_DENYWRITE    0x0800        /* ETXTBSY */
  2161. -#define MAP_EXECUTABLE    0x1000        /* mark it as a executable */
  2162. -
  2163. -#define MS_ASYNC    1    /* sync memory asynchronously */
  2164. -#define MS_INVALIDATE    2    /* invalidate the caches */
  2165. -#define MS_SYNC        4    /* synchronous memory sync */
  2166. +#include <asm/mman.h>
  2167.  
  2168.  #endif /* _LINUX_MMAN_H */
  2169. diff -u --recursive --new-file v1.3.11/linux/include/linux/trdevice.h linux/include/linux/trdevice.h
  2170. --- v1.3.11/linux/include/linux/trdevice.h    Tue Jul 18 16:28:59 1995
  2171. +++ linux/include/linux/trdevice.h    Wed Jul 19 14:52:34 1995
  2172. @@ -28,9 +28,9 @@
  2173.  #include <linux/if_tr.h>
  2174.  
  2175.  #ifdef __KERNEL__
  2176. -extern int        tr_header(unsigned char *buff, struct device *dev,
  2177. +extern int        tr_header(struct sk_buff *skb, struct device *dev,
  2178.                     unsigned short type, void *daddr,
  2179. -                   void *saddr, unsigned len, struct sk_buff *skb);
  2180. +                   void *saddr, unsigned len);
  2181.  extern int        tr_rebuild_header(void *buff, struct device *dev,
  2182.              unsigned long raddr, struct sk_buff *skb);
  2183.  extern unsigned short    tr_type_trans(struct sk_buff *skb, struct device *dev);
  2184. diff -u --recursive --new-file v1.3.11/linux/kernel/fork.c linux/kernel/fork.c
  2185. --- v1.3.11/linux/kernel/fork.c    Tue Jul 18 16:28:59 1995
  2186. +++ linux/kernel/fork.c    Tue Jul 18 17:15:38 1995
  2187. @@ -192,6 +192,8 @@
  2188.      p->state = TASK_UNINTERRUPTIBLE;
  2189.      p->flags &= ~(PF_PTRACED|PF_TRACESYS);
  2190.      p->pid = last_pid;
  2191. +    p->next_run = NULL;
  2192. +    p->prev_run = NULL;
  2193.      p->p_pptr = p->p_opptr = current;
  2194.      p->p_cptr = NULL;
  2195.      p->signal = 0;
  2196. diff -u --recursive --new-file v1.3.11/linux/kernel/ksyms.c linux/kernel/ksyms.c
  2197. --- v1.3.11/linux/kernel/ksyms.c    Tue Jul 18 16:28:59 1995
  2198. +++ linux/kernel/ksyms.c    Mon Jul 24 17:38:26 1995
  2199. @@ -386,9 +386,6 @@
  2200.       X(dispatch_scsi_info_ptr),
  2201.      X(generic_proc_info),
  2202.       X(scsi_devices),
  2203. -     X(free_pages),
  2204. -        X(print_msg),
  2205. -    X(print_status),
  2206.      X(gendisk_head), /* Needed for sd.c */
  2207.      X(resetup_one_dev), /* Needed for sd.c */
  2208.  #else
  2209. diff -u --recursive --new-file v1.3.11/linux/kernel/sched.c linux/kernel/sched.c
  2210. --- v1.3.11/linux/kernel/sched.c    Tue Jul 18 16:28:59 1995
  2211. +++ linux/kernel/sched.c    Tue Jul 18 17:56:31 1995
  2212. @@ -92,32 +92,77 @@
  2213.  
  2214.  struct kernel_stat kstat = { 0 };
  2215.  
  2216. +static inline void add_to_runqueue(struct task_struct * p)
  2217. +{
  2218. +#if 1    /* sanity tests */
  2219. +    if (p->next_run || p->prev_run) {
  2220. +        printk("task already on run-queue\n");
  2221. +        return;
  2222. +    }
  2223. +#endif
  2224. +    if (p->counter > current->counter + 3)
  2225. +        need_resched = 1;
  2226. +    nr_running++;
  2227. +    (p->next_run = init_task.next_run)->prev_run = p;
  2228. +    p->prev_run = &init_task;
  2229. +    init_task.next_run = p;
  2230. +}
  2231. +
  2232. +static inline void del_from_runqueue(struct task_struct * p)
  2233. +{
  2234. +    struct task_struct *next = p->next_run;
  2235. +    struct task_struct *prev = p->prev_run;
  2236. +
  2237. +#if 1    /* sanity tests */
  2238. +    if (!next || !prev) {
  2239. +        printk("task not on run-queue\n");
  2240. +        return;
  2241. +    }
  2242. +#endif
  2243. +    if (p == &init_task) {
  2244. +        printk("idle task may not sleep\n");
  2245. +        return;
  2246. +    }
  2247. +    nr_running--;
  2248. +    next->prev_run = prev;
  2249. +    prev->next_run = next;
  2250. +    p->next_run = NULL;
  2251. +    p->prev_run = NULL;
  2252. +}
  2253. +
  2254.  /*
  2255.   * Wake up a process. Put it on the run-queue if it's not
  2256.   * already there.  The "current" process is always on the
  2257. - * run-queue, and as such you're allowed to do the simpler
  2258. + * run-queue (except when the actual re-schedule is in
  2259. + * progress), and as such you're allowed to do the simpler
  2260.   * "current->state = TASK_RUNNING" to mark yourself runnable
  2261.   * without the overhead of this.
  2262. - *
  2263. - * (actually, the run-queue isn't implemented yet, so this
  2264. - * function is mostly a dummy one)
  2265.   */
  2266.  inline void wake_up_process(struct task_struct * p)
  2267.  {
  2268. -    long oldstate;
  2269. +    unsigned long flags;
  2270.  
  2271. -    oldstate = xchg(&p->state, TASK_RUNNING);
  2272. -    /* already on run-queue? */
  2273. -    if (oldstate == TASK_RUNNING || p == current)
  2274. -        return;
  2275. -    if (p->counter > current->counter + 3)
  2276. -        need_resched = 1;
  2277. +    save_flags(flags);
  2278. +    cli();
  2279. +    p->state = TASK_RUNNING;
  2280. +    if (!p->next_run)
  2281. +        add_to_runqueue(p);
  2282. +    restore_flags(flags);
  2283. +}
  2284. +
  2285. +static void process_timeout(unsigned long __data)
  2286. +{
  2287. +    struct task_struct * p = (struct task_struct *) __data;
  2288. +
  2289. +    p->timeout = 0;
  2290. +    wake_up_process(p);
  2291.  }
  2292.  
  2293.  /*
  2294.   *  'schedule()' is the scheduler function. It's a very simple and nice
  2295.   * scheduler: it's not perfect, but certainly works for most things.
  2296. - * The one thing you might take a look at is the signal-handler code here.
  2297. + *
  2298. + * The goto is "interesting".
  2299.   *
  2300.   *   NOTE!!  Task 0 is the 'idle' task, which gets called when no other
  2301.   * tasks can run. It can not be killed, and it cannot sleep. The 'state'
  2302. @@ -128,6 +173,7 @@
  2303.      int c;
  2304.      struct task_struct * p;
  2305.      struct task_struct * next;
  2306. +    unsigned long timeout = 0;
  2307.  
  2308.  /* check alarm, wake up any interruptible tasks that have got a signal */
  2309.  
  2310. @@ -137,31 +183,39 @@
  2311.      }
  2312.      run_task_queue(&tq_scheduler);
  2313.  
  2314. -    if (current->state == TASK_INTERRUPTIBLE) {
  2315. -        if (current->signal & ~current->blocked)
  2316. -            current->state = TASK_RUNNING;
  2317. -    }
  2318.      need_resched = 0;
  2319. -    nr_running = 0;
  2320. +    cli();
  2321. +    switch (current->state) {
  2322. +        case TASK_INTERRUPTIBLE:
  2323. +            if (current->signal & ~current->blocked)
  2324. +                goto makerunnable;
  2325. +            timeout = current->timeout;
  2326. +            if (timeout && (timeout <= jiffies)) {
  2327. +                current->timeout = 0;
  2328. +                timeout = 0;
  2329. +        makerunnable:
  2330. +                current->state = TASK_RUNNING;
  2331. +                break;
  2332. +            }
  2333. +        default:
  2334. +            del_from_runqueue(current);
  2335. +        case TASK_RUNNING:
  2336. +    }
  2337. +    p = init_task.next_run;
  2338. +    sti();
  2339.  
  2340. +/*
  2341. + * Note! there may appear new tasks on the run-queue during this, as
  2342. + * interrupts are enabled. However, they will be put on front of the
  2343. + * list, so our list starting at "p" is essentially fixed.
  2344. + */
  2345.  /* this is the scheduler proper: */
  2346.      c = -1000;
  2347.      next = &init_task;
  2348. -    for_each_task(p) {
  2349. -        switch (p->state) {
  2350. -            case TASK_INTERRUPTIBLE:
  2351. -                if (!p->timeout)
  2352. -                    continue;
  2353. -                if (p->timeout > jiffies)
  2354. -                    continue;
  2355. -                p->timeout = 0;
  2356. -                p->state = TASK_RUNNING;
  2357. -            /* fall through */
  2358. -            case TASK_RUNNING:
  2359. -                nr_running++;
  2360. -                if (p->counter > c)
  2361. -                    c = p->counter, next = p;
  2362. -        }
  2363. +    while (p != &init_task) {
  2364. +        if (p->counter > c)
  2365. +            c = p->counter, next = p;
  2366. +        p = p->next_run;
  2367.      }
  2368.  
  2369.      /* if all runnable processes have "counter == 0", re-calculate counters */
  2370. @@ -169,10 +223,21 @@
  2371.          for_each_task(p)
  2372.              p->counter = (p->counter >> 1) + p->priority;
  2373.      }
  2374. -    if (current == next)
  2375. -        return;
  2376. -    kstat.context_swtch++;
  2377. -    switch_to(next);
  2378. +    if (current != next) {
  2379. +        struct timer_list timer;
  2380. +
  2381. +        kstat.context_swtch++;
  2382. +        if (timeout) {
  2383. +            init_timer(&timer);
  2384. +            timer.expires = timeout - jiffies;
  2385. +            timer.data = (unsigned long) current;
  2386. +            timer.function = process_timeout;
  2387. +            add_timer(&timer);
  2388. +        }
  2389. +        switch_to(next);
  2390. +        if (timeout)
  2391. +            del_timer(&timer);
  2392. +    }
  2393.  }
  2394.  
  2395.  asmlinkage int sys_pause(void)
  2396. diff -u --recursive --new-file v1.3.11/linux/lib/string.c linux/lib/string.c
  2397. --- v1.3.11/linux/lib/string.c    Tue Jun  6 18:17:33 1995
  2398. +++ linux/lib/string.c    Thu Jul 20 09:48:13 1995
  2399. @@ -12,9 +12,11 @@
  2400.   */
  2401.   
  2402.  #include <linux/types.h>
  2403. +#include <linux/string.h>
  2404.  
  2405.  char * ___strtok = NULL;
  2406.  
  2407. +#ifndef __HAVE_ARCH_STRCPY
  2408.  char * strcpy(char * dest,const char *src)
  2409.  {
  2410.      char *tmp = dest;
  2411. @@ -23,7 +25,9 @@
  2412.          /* nothing */;
  2413.      return tmp;
  2414.  }
  2415. +#endif
  2416.  
  2417. +#ifndef __HAVE_ARCH_STRNCPY
  2418.  char * strncpy(char * dest,const char *src,size_t count)
  2419.  {
  2420.      char *tmp = dest;
  2421. @@ -33,7 +37,9 @@
  2422.  
  2423.      return tmp;
  2424.  }
  2425. +#endif
  2426.  
  2427. +#ifndef __HAVE_ARCH_STRCAT
  2428.  char * strcat(char * dest, const char * src)
  2429.  {
  2430.      char *tmp = dest;
  2431. @@ -45,7 +51,9 @@
  2432.  
  2433.      return tmp;
  2434.  }
  2435. +#endif
  2436.  
  2437. +#ifndef __HAVE_ARCH_STRNCAT
  2438.  char * strncat(char *dest, const char *src, size_t count)
  2439.  {
  2440.      char *tmp = dest;
  2441. @@ -61,7 +69,9 @@
  2442.  
  2443.      return tmp;
  2444.  }
  2445. +#endif
  2446.  
  2447. +#ifndef __HAVE_ARCH_STRCMP
  2448.  int strcmp(const char * cs,const char * ct)
  2449.  {
  2450.      register signed char __res;
  2451. @@ -73,7 +83,9 @@
  2452.  
  2453.      return __res;
  2454.  }
  2455. +#endif
  2456.  
  2457. +#ifndef __HAVE_ARCH_STRNCMP
  2458.  int strncmp(const char * cs,const char * ct,size_t count)
  2459.  {
  2460.      register signed char __res = 0;
  2461. @@ -86,7 +98,9 @@
  2462.  
  2463.      return __res;
  2464.  }
  2465. +#endif
  2466.  
  2467. +#ifndef __HAVE_ARCH_STRCHR
  2468.  char * strchr(const char * s,char c)
  2469.  {
  2470.      for(; *s != c; ++s)
  2471. @@ -94,7 +108,9 @@
  2472.              return NULL;
  2473.      return (char *) s;
  2474.  }
  2475. +#endif
  2476.  
  2477. +#ifndef __HAVE_ARCH_STRLEN
  2478.  size_t strlen(const char * s)
  2479.  {
  2480.      const char *sc;
  2481. @@ -103,7 +119,9 @@
  2482.          /* nothing */;
  2483.      return sc - s;
  2484.  }
  2485. +#endif
  2486.  
  2487. +#ifndef __HAVE_ARCH_STRNLEN
  2488.  size_t strnlen(const char * s, size_t count)
  2489.  {
  2490.      const char *sc;
  2491. @@ -112,7 +130,9 @@
  2492.          /* nothing */;
  2493.      return sc - s;
  2494.  }
  2495. +#endif
  2496.  
  2497. +#ifndef __HAVE_ARCH_STRSPN
  2498.  size_t strspn(const char *s, const char *accept)
  2499.  {
  2500.      const char *p;
  2501. @@ -131,7 +151,9 @@
  2502.  
  2503.      return count;
  2504.  }
  2505. +#endif
  2506.  
  2507. +#ifndef __HAVE_ARCH_STRPBRK
  2508.  char * strpbrk(const char * cs,const char * ct)
  2509.  {
  2510.      const char *sc1,*sc2;
  2511. @@ -144,7 +166,9 @@
  2512.      }
  2513.      return NULL;
  2514.  }
  2515. +#endif
  2516.  
  2517. +#ifndef __HAVE_ARCH_STRTOK
  2518.  char * strtok(char * s,const char * ct)
  2519.  {
  2520.      char *sbegin, *send;
  2521. @@ -164,7 +188,9 @@
  2522.      ___strtok = send;
  2523.      return (sbegin);
  2524.  }
  2525. +#endif
  2526.  
  2527. +#ifndef __HAVE_ARCH_MEMSET
  2528.  void * memset(void * s,char c,size_t count)
  2529.  {
  2530.      char *xs = (char *) s;
  2531. @@ -174,7 +200,9 @@
  2532.  
  2533.      return s;
  2534.  }
  2535. +#endif
  2536.  
  2537. +#ifndef __HAVE_ARCH_BCOPY
  2538.  char * bcopy(const char * src, char * dest, int count)
  2539.  {
  2540.      char *tmp = dest;
  2541. @@ -184,7 +212,9 @@
  2542.  
  2543.      return dest;
  2544.  }
  2545. +#endif
  2546.  
  2547. +#ifndef __HAVE_ARCH_MEMCPY
  2548.  void * memcpy(void * dest,const void *src,size_t count)
  2549.  {
  2550.      char *tmp = (char *) dest, *s = (char *) src;
  2551. @@ -194,7 +224,9 @@
  2552.  
  2553.      return dest;
  2554.  }
  2555. +#endif
  2556.  
  2557. +#ifndef __HAVE_ARCH_MEMMOVE
  2558.  void * memmove(void * dest,const void *src,size_t count)
  2559.  {
  2560.      char *tmp, *s;
  2561. @@ -214,7 +246,9 @@
  2562.  
  2563.      return dest;
  2564.  }
  2565. +#endif
  2566.  
  2567. +#ifndef __HAVE_ARCH_MEMCMP
  2568.  int memcmp(const void * cs,const void * ct,size_t count)
  2569.  {
  2570.      const unsigned char *su1, *su2;
  2571. @@ -225,10 +259,12 @@
  2572.              break;
  2573.      return res;
  2574.  }
  2575. +#endif
  2576.  
  2577.  /*
  2578.   * find the first occurrence of byte 'c', or 1 past the area if none
  2579.   */
  2580. +#ifndef __HAVE_ARCH_MEMSCAN
  2581.  void * memscan(void * addr, unsigned char c, size_t size)
  2582.  {
  2583.      unsigned char * p = (unsigned char *) addr;
  2584. @@ -241,7 +277,9 @@
  2585.      }
  2586.        return (void *) p;
  2587.  }
  2588. +#endif
  2589.  
  2590. +#ifndef __HAVE_ARCH_STRSTR
  2591.  char * strstr(const char * s1,const char * s2)
  2592.  {
  2593.      int l1, l2;
  2594. @@ -258,3 +296,4 @@
  2595.      }
  2596.      return NULL;
  2597.  }
  2598. +#endif
  2599. diff -u --recursive --new-file v1.3.11/linux/net/802/tr.c linux/net/802/tr.c
  2600. --- v1.3.11/linux/net/802/tr.c    Fri Jul  7 08:54:56 1995
  2601. +++ linux/net/802/tr.c    Wed Jul 19 14:52:34 1995
  2602. @@ -38,11 +38,12 @@
  2603.  #define RIF_CHECK_INTERVAL 60*HZ
  2604.  static struct timer_list rif_timer={ NULL,NULL,RIF_CHECK_INTERVAL,0L,rif_check_expire };
  2605.  
  2606. -int tr_header(unsigned char *buff, struct device *dev, unsigned short type,
  2607. -              void *daddr, void *saddr, unsigned len, struct sk_buff *skb) {
  2608. +int tr_header(struct sk_buff *skb, struct device *dev, unsigned short type,
  2609. +              void *daddr, void *saddr, unsigned len) 
  2610. +{
  2611.  
  2612.      struct trh_hdr *trh=(struct trh_hdr *)skb_push(skb,dev->hard_header_len);
  2613. -    struct trllc *trllc=(struct trllc *)(buff+sizeof(struct trh_hdr));
  2614. +    struct trllc *trllc=(struct trllc *)(trh+1);
  2615.  
  2616.      trh->ac=AC;
  2617.      trh->fc=LLC_FRAME;
  2618. @@ -91,6 +92,8 @@
  2619.  
  2620.      struct trh_hdr *trh=(struct trh_hdr *)skb->data;
  2621.      struct trllc *trllc=(struct trllc *)(skb->data+sizeof(struct trh_hdr));
  2622. +    
  2623. +    skb->mac.raw = skb->data;
  2624.      
  2625.      skb_pull(skb,dev->hard_header_len);
  2626.      
  2627. diff -u --recursive --new-file v1.3.11/linux/net/core/dev.c linux/net/core/dev.c
  2628. --- v1.3.11/linux/net/core/dev.c    Thu Jul 13 16:20:21 1995
  2629. +++ linux/net/core/dev.c    Wed Jul 19 14:52:34 1995
  2630. @@ -172,6 +172,7 @@
  2631.              return;
  2632.          }
  2633.      }
  2634. +    printk("dev_remove_pack: %p not found.\n", pt);
  2635.  }
  2636.  
  2637.  /*****************************************************************************************
  2638. diff -u --recursive --new-file v1.3.11/linux/net/ipv4/ip.c linux/net/ipv4/ip.c
  2639. --- v1.3.11/linux/net/ipv4/ip.c    Thu Jul 13 16:20:22 1995
  2640. +++ linux/net/ipv4/ip.c    Mon Jul 24 17:38:34 1995
  2641. @@ -85,6 +85,8 @@
  2642.   *    Dave Bonn,Alan Cox    :    Faster IP forwarding whenever possible.
  2643.   *        Alan Cox    :    Memory leaks, tramples, misc debugging.
  2644.   *        Alan Cox    :    Fixed multicast (by popular demand 8))
  2645. + *        Alan Cox    :    Fixed forwarding (by even more popular demand 8))
  2646. + *        Alan Cox    :    Fixed SNMP statistics [I think]
  2647.   *
  2648.   *  
  2649.   *
  2650. @@ -153,7 +155,7 @@
  2651.  #ifdef CONFIG_IP_FORWARD
  2652.  struct ip_mib ip_statistics={1,64,};    /* Forwarding=Yes, Default TTL=64 */
  2653.  #else
  2654. -struct ip_mib ip_statistics={0,64,};    /* Forwarding=No, Default TTL=64 */
  2655. +struct ip_mib ip_statistics={2,64,};    /* Forwarding=No, Default TTL=64 */
  2656.  #endif
  2657.  
  2658.  /*
  2659. @@ -1139,7 +1141,7 @@
  2660.       */
  2661.  
  2662.      dev2 = rt->rt_dev;
  2663. -
  2664. +    
  2665.      /*
  2666.       *    In IP you never have to forward a frame on the interface that it 
  2667.       *    arrived upon. We now generate an ICMP HOST REDIRECT giving the route
  2668. @@ -1165,33 +1167,35 @@
  2669.          if (!(is_frag&4) && fw_res==2)
  2670.              ip_fw_masquerade(&skb, dev2);
  2671.  #endif
  2672. +        IS_SKB(skb);
  2673.  
  2674.          if(skb_headroom(skb)<dev2->hard_header_len)
  2675. +        {
  2676.              skb2 = alloc_skb(dev2->hard_header_len + skb->len + 15, GFP_ATOMIC);
  2677. -        else skb2=skb;
  2678. +            IS_SKB(skb2);
  2679.          
  2680. -        /*
  2681. -         *    This is rare and since IP is tolerant of network failures
  2682. -         *    quite harmless.
  2683. -         */
  2684. +            /*
  2685. +             *    This is rare and since IP is tolerant of network failures
  2686. +             *    quite harmless.
  2687. +             */
  2688.          
  2689. -        if (skb2 == NULL)
  2690. -        {
  2691. -            NETDEBUG(printk("\nIP: No memory available for IP forward\n"));
  2692. -            return -1;
  2693. -        }
  2694. +            if (skb2 == NULL)
  2695. +            {
  2696. +                NETDEBUG(printk("\nIP: No memory available for IP forward\n"));
  2697. +                return -1;
  2698. +            }
  2699.          
  2700. +            /*
  2701. +             *    Add the physical headers.
  2702. +             */
  2703.  
  2704. -        /* Now build the MAC header. */
  2705. -        (void) ip_send(skb2, raddr, skb->len, dev2, dev2->pa_addr);
  2706. +             ip_send(skb2,raddr,skb->len,dev2,dev2->pa_addr);
  2707.  
  2708. -        /*
  2709. -         *    We have to copy the bytes over as the new header wouldn't fit
  2710. -         *    the old buffer. This should be very rare.
  2711. -         */
  2712. -         
  2713. -        if(skb2!=skb)
  2714. -        {
  2715. +            /*
  2716. +             *    We have to copy the bytes over as the new header wouldn't fit
  2717. +             *    the old buffer. This should be very rare.
  2718. +             */         
  2719. +             
  2720.              ptr = skb_put(skb2,skb->len);
  2721.              skb2->free = 1;
  2722.              skb2->h.raw = ptr;
  2723. @@ -1201,9 +1205,23 @@
  2724.               */
  2725.              memcpy(ptr, skb->h.raw, skb->len);
  2726.          }
  2727. +        else
  2728. +        {
  2729. +            /* 
  2730. +             *    Build a new MAC header. 
  2731. +             */
  2732.  
  2733. -        ip_statistics.IpForwDatagrams++;
  2734. -
  2735. +            skb2 = skb;        
  2736. +            skb2->dev=dev2;
  2737. +            skb->arp=1;
  2738. +            skb->raddr=raddr;
  2739. +            if(dev2->hard_header)
  2740. +            {
  2741. +                if(dev2->hard_header(skb, dev2, ETH_P_IP, NULL, NULL, skb->len)<0)
  2742. +                    skb->arp=0;
  2743. +            }
  2744. +            ip_statistics.IpForwDatagrams++;
  2745. +        }
  2746.          /*
  2747.           *    See if it needs fragmenting. Note in ip_rcv we tagged
  2748.           *    the fragment type. This must be right so that
  2749. @@ -2347,6 +2365,7 @@
  2750.      struct iphdr *iph;
  2751.      int local=0;
  2752.      struct device *dev;
  2753. +    int nfrags=0;
  2754.      
  2755.      ip_statistics.IpOutRequests++;
  2756.  
  2757. @@ -2437,7 +2456,10 @@
  2758.          int error;
  2759.          struct sk_buff *skb=sock_alloc_send_skb(sk, length+20+15+dev->hard_header_len,0,&error);
  2760.          if(skb==NULL)
  2761. +        {
  2762. +            ip_statistics.IpOutDiscards++;
  2763.              return error;
  2764. +        }
  2765.          skb->dev=dev;
  2766.          skb->free=1;
  2767.          skb->when=jiffies;
  2768. @@ -2555,8 +2577,13 @@
  2769.  
  2770.          skb = sock_alloc_send_skb(sk, fraglen+15, 0, &error);
  2771.          if (skb == NULL)
  2772. +        {
  2773. +            ip_statistics.IpOutDiscards++;
  2774. +            if(nfrags>1)
  2775. +                ip_statistics.IpFragCreates++;            
  2776.              return(error);
  2777. -
  2778. +        }
  2779. +        
  2780.          /*
  2781.           *    Fill in the control structures
  2782.           */
  2783. @@ -2689,6 +2716,9 @@
  2784.                  kfree_skb(skb, FREE_READ);
  2785.          }
  2786.  #endif
  2787. +
  2788. +        nfrags++;
  2789. +        
  2790.          /*
  2791.           *    BSD loops broadcasts
  2792.           */
  2793. @@ -2715,12 +2745,15 @@
  2794.               */
  2795.               
  2796.              ip_statistics.IpOutDiscards++;
  2797. +            if(nfrags>1)
  2798. +                ip_statistics.IpFragCreates+=nfrags;
  2799.              kfree_skb(skb, FREE_WRITE);
  2800.              return(0); /* lose rest of fragments */
  2801.          }
  2802.      } 
  2803.      while (offset >= 0);
  2804. -    
  2805. +    if(nfrags>1)
  2806. +        ip_statistics.IpFragCreates+=nfrags;
  2807.      return(0);
  2808.  }
  2809.      
  2810. diff -u --recursive --new-file v1.3.11/linux/net/ipv4/ip_fw.c linux/net/ipv4/ip_fw.c
  2811. --- v1.3.11/linux/net/ipv4/ip_fw.c    Tue Jul 18 16:28:59 1995
  2812. +++ linux/net/ipv4/ip_fw.c    Wed Jul 19 14:52:34 1995
  2813. @@ -1483,7 +1483,7 @@
  2814.          int timer_active = del_timer(&ms->timer);
  2815.          if (!timer_active)
  2816.              ms->timer.expires = 0;
  2817. -        len+=sprintf(buffer+len,"%s %08lX:%04X %08lX:%04X %04X %08lX %5d %lu\n",
  2818. +        len+=sprintf(buffer+len,"%s %08lX:%04X %08lX:%04X %04X %08X %5d %lu\n",
  2819.              strProt[ms->protocol==IPPROTO_TCP],
  2820.              ntohl(ms->src),ntohs(ms->sport),
  2821.              ntohl(ms->dst),ntohs(ms->dport),
  2822.