Re: 1.3.27+patch crashes

Linus Torvalds (Linus.Torvalds@cs.helsinki.fi)
Sat, 16 Sep 1995 11:29:45 +0300


Andries.Brouwer@cwi.nl: "1.3.27+patch crashes" (Sep 15, 14:35):
> Another place where you have to test mm is in fs/namei.c:get_write_access().
>
> (Your patch helped to let the system survive .1 sec longer - it now
> crashed in lpd, with stack trace
> system_call -> sys_open -> do_open -> get_write_access
> )

Heh, that was one of the other bugs that I mentioned in my previous
mail. I guess I'd just better send you the whole "pre-patch-1.3.28" and
let you have all my current fixes. This fixes the NULL pointer stuff in
vmalloc.c and namei.c as well as some in the /proc-fs code.

There are some other patches in here as well, I'm too lazy to just pick
out the NULL pointer stuff.

Linus

----------
diff -u --recursive --new-file v1.3.27/linux/Makefile linux/Makefile
--- v1.3.27/linux/Makefile Fri Sep 15 11:12:59 1995
+++ linux/Makefile Fri Sep 15 10:59:43 1995
@@ -1,6 +1,6 @@
VERSION = 1
PATCHLEVEL = 3
-SUBLEVEL = 27
+SUBLEVEL = 28

ARCH = i386

@@ -98,7 +98,7 @@
DRIVERS := $(DRIVERS) drivers/scsi/scsi.a
endif

-ifdef CONFIG_SOUND
+ifeq ($(CONFIG_SOUND),y)
DRIVERS := $(DRIVERS) drivers/sound/sound.a
endif

diff -u --recursive --new-file v1.3.27/linux/arch/alpha/kernel/bios32.c linux/arch/alpha/kernel/bios32.c
--- v1.3.27/linux/arch/alpha/kernel/bios32.c Sun Sep 3 12:26:48 1995
+++ linux/arch/alpha/kernel/bios32.c Fri Sep 15 11:23:05 1995
@@ -401,7 +401,7 @@
*/
static inline void common_fixup(long min_idsel, long max_idsel, long irqs_per_slot,
char irq_tab[max_idsel - min_idsel + 1][irqs_per_slot],
- long ide_base)
+ long ide_base)
{
struct pci_dev *dev;
unsigned char pin;
diff -u --recursive --new-file v1.3.27/linux/arch/alpha/kernel/irq.c linux/arch/alpha/kernel/irq.c
--- v1.3.27/linux/arch/alpha/kernel/irq.c Wed Sep 13 12:45:29 1995
+++ linux/arch/alpha/kernel/irq.c Fri Sep 15 11:23:05 1995
@@ -31,13 +31,9 @@
static unsigned char cache_804 = 0xef;
static unsigned char cache_805 = 0xff;
static unsigned char cache_806 = 0xff;
-# define NUM_IRQS 33
#elif defined(CONFIG_ALPHA_EB66) || defined(CONFIG_ALPHA_EB64P)
static unsigned char cache_26 = 0xdf;
static unsigned char cache_27 = 0xff;
-# define NUM_IRQS 32
-#else
-# define NUM_IRQS 16
#endif

void disable_irq(unsigned int irq_nr)
@@ -103,7 +99,7 @@
cache_806 &= mask;
outb(cache_806, 0x806);
#elif defined(CONFIG_ALPHA_EB66) || defined(CONFIG_ALPHA_EB64P)
- } else if if (irq_nr < 24) {
+ } else if (irq_nr < 24) {
cache_26 &= mask;
outb(cache_26, 0x26);
} else {
@@ -124,14 +120,14 @@
const char *name;
};

-static struct irqaction irq_action[NUM_IRQS];
+static struct irqaction irq_action[NR_IRQS];

int get_irq_list(char *buf)
{
int i, len = 0;
struct irqaction * action = irq_action;

- for (i = 0 ; i < NUM_IRQS ; i++, action++) {
+ for (i = 0 ; i < NR_IRQS ; i++, action++) {
if (!action->handler)
continue;
len += sprintf(buf+len, "%2d: %8d %c %s\n",
@@ -225,7 +221,7 @@
struct irqaction * action;
unsigned long flags;

- if (irq >= NUM_IRQS)
+ if (irq >= NR_IRQS)
return -EINVAL;
action = irq + irq_action;
if (action->handler)
@@ -251,7 +247,7 @@
struct irqaction * action = irq + irq_action;
unsigned long flags;

- if (irq >= NUM_IRQS) {
+ if (irq >= NR_IRQS) {
printk("Trying to free IRQ%d\n", irq);
return;
}
@@ -310,7 +306,7 @@
{
struct irqaction * action;

- if ((unsigned) irq > NUM_IRQS) {
+ if ((unsigned) irq > NR_IRQS) {
printk("device_interrupt: unexpected interrupt %d\n", irq);
return;
}
@@ -473,7 +469,7 @@
device_interrupt(irq, ack, regs);
}

-#if NUM_IRQS > 64
+#if NR_IRQS > 64
# error Number of irqs limited to 64 due to interrupt-probing.
#endif

@@ -486,7 +482,7 @@
unsigned long delay;
unsigned int i;

- for (i = NUM_IRQS - 1; i > 0; i--) {
+ for (i = NR_IRQS - 1; i > 0; i--) {
if (!irq_action[i].handler) {
enable_irq(i);
irqs |= (1 << i);
@@ -505,7 +501,7 @@
(((unsigned long)cache_806)<<24));
#elif defined(CONFIG_ALPHA_EB66) || defined(CONFIG_ALPHA_EB64P)
irqmask |= ((((unsigned long)cache_26)<<16) |
- (((unsigned long)cache_27)<<24);
+ (((unsigned long)cache_27)<<24));
#endif
irqs &= ~irqmask;
return irqs;
@@ -528,7 +524,7 @@
(((unsigned long)cache_806)<<24));
#elif defined(CONFIG_ALPHA_EB66) || defined(CONFIG_ALPHA_EB64P)
irqmask |= ((((unsigned long)cache_26)<<16) |
- (((unsigned long)cache_27)<<24);
+ (((unsigned long)cache_27)<<24));
#endif
irqs &= irqmask;
if (!irqs)
diff -u --recursive --new-file v1.3.27/linux/arch/alpha/kernel/process.c linux/arch/alpha/kernel/process.c
--- v1.3.27/linux/arch/alpha/kernel/process.c Wed Sep 13 12:45:29 1995
+++ linux/arch/alpha/kernel/process.c Fri Sep 15 11:23:05 1995
@@ -168,16 +168,3 @@
putname(filename);
return error;
}
-
-/*
- * This doesn't actually work correctly like this: we need to do the
- * same stack setups that fork() does first.
- */
-asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, unsigned long a2,
- unsigned long a3, unsigned long a4, unsigned long a5,
- struct pt_regs regs)
-{
- if (!newsp)
- newsp = rdusp();
- return do_fork(clone_flags, newsp, &regs);
-}
diff -u --recursive --new-file v1.3.27/linux/arch/alpha/kernel/setup.c linux/arch/alpha/kernel/setup.c
--- v1.3.27/linux/arch/alpha/kernel/setup.c Sun Sep 3 12:26:49 1995
+++ linux/arch/alpha/kernel/setup.c Fri Sep 15 11:23:05 1995
@@ -55,7 +55,7 @@
* code think we're on a VGA color display.
*/
struct screen_info screen_info = {
- 0, 0, /* orig-x, orig-y */
+ 0, 25, /* orig-x, orig-y */
{ 0, 0 }, /* unused */
0, /* orig-video-page */
0, /* orig-video-mode */
diff -u --recursive --new-file v1.3.27/linux/arch/alpha/vmlinux.lds linux/arch/alpha/vmlinux.lds
--- v1.3.27/linux/arch/alpha/vmlinux.lds Thu Jul 13 16:20:19 1995
+++ linux/arch/alpha/vmlinux.lds Fri Sep 15 11:23:05 1995
@@ -40,6 +40,7 @@
.sbss : {
*(.sbss)
*(.scommon)
+ . = ALIGN(16);
}
.bss : {
*(.bss)
diff -u --recursive --new-file v1.3.27/linux/arch/i386/config.in linux/arch/i386/config.in
--- v1.3.27/linux/arch/i386/config.in Fri Sep 15 11:12:59 1995
+++ linux/arch/i386/config.in Fri Sep 15 10:59:43 1995
@@ -303,7 +303,7 @@

comment 'Sound'

-bool 'Sound card support' CONFIG_SOUND n
+tristate 'Sound card support' CONFIG_SOUND n

comment 'Kernel hacking'

diff -u --recursive --new-file v1.3.27/linux/drivers/Makefile linux/drivers/Makefile
--- v1.3.27/linux/drivers/Makefile Tue Aug 15 20:39:00 1995
+++ linux/drivers/Makefile Fri Sep 15 10:59:43 1995
@@ -20,11 +20,9 @@
MOD_SUB_DIRS += scsi
endif

-# I think this should have an else clause for modules, but the original
-# makefile did not, so I am not adding it.
-# -jln 12 Aug 1995
ifdef CONFIG_SOUND
SUB_DIRS += sound
+MOD_SUB_DIRS += sound
endif

include $(TOPDIR)/Rules.make
diff -u --recursive --new-file v1.3.27/linux/drivers/block/README.ide linux/drivers/block/README.ide
--- v1.3.27/linux/drivers/block/README.ide Sun Sep 3 16:12:48 1995
+++ linux/drivers/block/README.ide Fri Sep 15 10:59:44 1995
@@ -29,26 +29,27 @@
- can co-exist with hd.c controlling the first interface
- run-time selectable 32bit interface support (using hdparm-2.3)
NEW! - support for reliable operation of buggy RZ1000 interfaces
-NEW! - PCI support is automatic
+ - PCI support is automatic
NEW! - support for reliable operation of buggy CMD-640 interfaces
-NEW! - PCI support is automatic
-NEW! - for VLB, use kernel command line option: ide0=cmd640_vlb
-NEW! - this support also enables the secondary i/f on most cards
+ - PCI support is automatic
+ - for VLB, use kernel command line option: ide0=cmd640_vlb
+ - this support also enables the secondary i/f on most cards
NEW! - support for secondary interface on the FGI/Holtek HT-6560B VLB i/f
-NEW! - use kernel command line option: ide1=ht6560
+ - use kernel command line option: ide1=ht6560
NEW! - experimental support for DTC-2278D interfaces
-NEW! - use kernel command line option: ide1=dtc2278
+ - use kernel command line option: ide1=dtc2278
NEW! - support for drives with a stuck WRERR_STAT bit
NEW! - support for removeable devices, including door lock/unlock
NEW! - transparent support for DiskManager 6.0x and "Dynamic Disk Overlay"
-NEW! - works with Linux fdisk, LILO, loadlin, bootln, etc..
-NEW! - should work for for EZ-Drive disks as well (not verified)
+ - works with Linux fdisk, LILO, loadlin, bootln, etc..
+NEW! - mostly transparent support for EZ-Drive
+ - LILO is incompatible (also harmless) with EZ-Drive
NEW! - ide-cd.c now compiles separate from ide.c
NEW! - Bus-Master DMA support for Intel PCI Triton chipset IDE interfaces
-NEW! - for details, see comments at top of triton.c
+ - for details, see comments at top of triton.c
NEW! - ide-cd.c now supports door locking and auto-loading.
-NEW! Also preliminary support for multisession and direct
-NEW! reads of audio data.
+ - Also preliminary support for multisession
+ and direct reads of audio data.

For work in progress, see the comments in ide.c, ide-cd.c, and triton.c.

@@ -451,3 +452,27 @@
San Jose, CA

Silicon Valley - best day job in the world
+
+================================================================================
+
+ from: 'delman@mipg.upenn.edu'
+ subject: rz1000
+
+Hi Mark! Looks like you managed to get the info from Intel to disable
+the read-ahead feature of the RZ1000. My encounter with
+Zeos (subsidiary of Micron which owns PCTech) has not been as
+successful --- one guy needs to ask his supervisors about NDA, another
+guy thinks that there is too much of a performance hit with read-ahead
+disabled.
+
+Did the following benchmark to see how true the claim is.
+With Linux 1.2.13, average of 10 "hdparm -t" in MB/s:
+
+ hdparm -c0 hdparm -c1
+read-ahead enabled 4.28 4.25
+read-ahead disabled 3.58 4.30
+
+Maybe -c1 should be the default for the RZ1000, or as a suggestion in
+the README for people with the RZ1000.
+
+Cheers, Delman.
diff -u --recursive --new-file v1.3.27/linux/drivers/block/genhd.c linux/drivers/block/genhd.c
--- v1.3.27/linux/drivers/block/genhd.c Wed Sep 13 12:45:29 1995
+++ linux/drivers/block/genhd.c Fri Sep 15 10:59:44 1995
@@ -162,6 +162,7 @@
int i, minor = current_minor;
struct buffer_head *bh;
struct partition *p;
+ unsigned char *data;
int mask = (1 << hd->minor_shift) - 1;
#ifdef CONFIG_BLK_DEV_IDE
int tested_for_dm6 = 0;
@@ -172,11 +173,18 @@
printk(" unable to read partition table\n");
return -1;
}
- if (*(unsigned short *) (0x1fe + bh->b_data) != 0xAA55) {
+ data = bh->b_data;
+ bh->b_dirt = 0; /* In some cases we modify the geometry */
+ bh->b_uptodate = 0; /* of the drive (below), so ensure that */
+ bh->b_req = 0; /* nobody else tries to re-use this data. */
+#ifdef CONFIG_BLK_DEV_IDE
+check_table:
+#endif
+ if (*(unsigned short *) (0x1fe + data) != 0xAA55) {
brelse(bh);
return 0;
}
- p = (struct partition *) (0x1be + bh->b_data);
+ p = (struct partition *) (0x1be + data);

#ifdef CONFIG_BLK_DEV_IDE
/*
@@ -184,9 +192,21 @@
*/
if (!tested_for_dm6++) { /* only check for DM6 *once* */
extern int ide_xlate_1024(dev_t, int, const char *);
- /* check for DM6 with Dynamic Drive Overlay (DDO) */
- if (p->sys_ind == DM6_PARTITION || p->sys_ind == EZD_PARTITION) {
- const char *label = (p->sys_ind == DM6_PARTITION)?" [DM6:DDO]":" [EZDRIVE]";
+ /* check for various "disk managers" which do strange things */
+ if (p->sys_ind == EZD_PARTITION) {
+ /*
+ * The remainder of the disk must be accessed using
+ * a translated geometry that reduces the number of
+ * apparent cylinders to less than 1024 if possible.
+ *
+ * ide_xlate_1024() will take care of the necessary
+ * adjustments to fool fdisk/LILO and partition check.
+ */
+ if (ide_xlate_1024(dev, -1, " [EZD]")) {
+ data += 512;
+ goto check_table;
+ }
+ } else if (p->sys_ind == DM6_PARTITION) {

/*
* Everything on the disk is offset by 63 sectors,
@@ -198,19 +218,16 @@
* ide_xlate_1024() will take care of the necessary
* adjustments to fool fdisk/LILO and partition check.
*/
- if (ide_xlate_1024(dev, 1, label)) {
- bh->b_dirt = 0; /* force re-read of MBR block */
- bh->b_uptodate = 0;
- bh->b_req = 0;
+ if (ide_xlate_1024(dev, 1, " [DM6:DDO]")) {
brelse(bh);
goto read_mbr; /* start over with new MBR */
}
} else {
/* look for DM6 signature in MBR, courtesy of OnTrack */
- unsigned int sig = *(unsigned short *)(bh->b_data + 2);
+ unsigned int sig = *(unsigned short *)(data + 2);
if (sig <= 0x1ae
- && *(unsigned short *)(bh->b_data + sig) == 0x55AA
- && (1 & *(unsigned char *)(bh->b_data + sig + 2)) )
+ && *(unsigned short *)(data + sig) == 0x55AA
+ && (1 & *(unsigned char *)(data + sig + 2)) )
{
(void) ide_xlate_1024 (dev, 0, " [DM6:MBR]");
} else {
@@ -218,7 +235,7 @@
if (p->sys_ind == DM6_AUX1PARTITION
|| p->sys_ind == DM6_AUX3PARTITION)
{
- (void)ide_xlate_1024(dev,0," [DM6:AUX]");
+ (void)ide_xlate_1024(dev, 0, " [DM6:AUX]");
}
}
}
@@ -252,8 +269,8 @@
/*
* Check for old-style Disk Manager partition table
*/
- if (*(unsigned short *) (bh->b_data+0xfc) == 0x55AA) {
- p = (struct partition *) (0x1be + bh->b_data);
+ if (*(unsigned short *) (data+0xfc) == 0x55AA) {
+ p = (struct partition *) (0x1be + data);
for (i = 4 ; i < 16 ; i++, current_minor++) {
p--;
if ((current_minor & mask) >= mask-2)
diff -u --recursive --new-file v1.3.27/linux/drivers/block/ide.c linux/drivers/block/ide.c
--- v1.3.27/linux/drivers/block/ide.c Wed Sep 13 12:45:29 1995
+++ linux/drivers/block/ide.c Fri Sep 15 10:59:44 1995
@@ -1,5 +1,5 @@
/*
- * linux/drivers/block/ide.c Version 5.13b Sep 9, 1995
+ * linux/drivers/block/ide.c Version 5.14 Sep 14, 1995
*
* Copyright (C) 1994, 1995 Linus Torvalds & authors (see below)
*/
@@ -141,11 +141,15 @@
* Version 5.13 fixed typo ('B'), thanks to houston@boyd.geog.mcgill.ca
* fixed ht6560b support
* Version 5.13b (sss) fix problem in calling ide_cdrom_setup()
- * don't bother invalidating nonexistent partitions
+ * don't bother invalidating nonexistent partitions
+ * Version 5.14 fixes to cmd640 support.. maybe it works now(?)
+ * added & tested full EZ-DRIVE support -- don't use LILO!
+ * don't enable 2nd CMD640 PCI port during init - conflict
*
* Driver compile-time options are in ide.h
*
* To do, in likely order of completion:
+ * - figure out why Mitsumi ATAPI cdroms are having trouble..
* - add ioctls to get/set interface timings on cmd640, ht6560b, triton
* - modify kernel to obtain BIOS geometry for drives on 2nd/3rd/4th i/f
* - improved CMD support: probably handing this off to someone else
@@ -1339,6 +1343,12 @@
goto kill_rq;
}
block += drive->part[minor&PARTN_MASK].start_sect + drive->sect0;
+#if FAKE_FDISK_FOR_EZDRIVE
+ if (block == 0 && drive->ezdrive) {
+ block = 1;
+ printk("%s: [EZD] accessing sector 1 instead of sector 0\n", drive->name);
+ }
+#endif /* FAKE_FDISK_FOR_EZDRIVE */
((ide_hwgroup_t *)hwif->hwgroup)->drive = drive;
#if (DISK_RECOVERY_TIME > 0)
while ((read_timer() - hwif->last_time) < DISK_RECOVERY_TIME);
@@ -2302,7 +2312,7 @@
#ifdef CONFIG_BLK_DEV_IDECD
if (drive->present && drive->media == cdrom)
ide_cdrom_setup(drive);
-#endif /* CONFIG_BLK_DEV_IDECD */
+#endif /* CONFIG_BLK_DEV_IDECD */
}
for (unit = 0; unit < MAX_DRIVES; ++unit) {
ide_drive_t *drive = &hwif->drives[unit];
@@ -2422,6 +2432,7 @@
}
}
write_cmd640_vlb(port, 0x51, read_cmd640_vlb(port, 0x51)|0xc8);
+ write_cmd640_vlb(port, 0x57, read_cmd640_vlb(port, 0x57)|0x0c);
printk("disabled read-ahead, enabled secondary\n");

}
@@ -2642,7 +2653,7 @@
* to "convert" a drive to a logical geometry with fewer than 1024 cyls
* It mimics the method used by Ontrack Disk Manager.
*/
-int ide_xlate_1024 (dev_t i_rdev, int need_offset, const char *msg)
+int ide_xlate_1024 (dev_t i_rdev, int offset, const char *msg)
{
ide_drive_t *drive;
static const byte head_vals[] = {4, 8, 16, 32, 64, 128, 255, 0};
@@ -2665,12 +2676,19 @@
if (0 == *++heads)
break;
}
- if (need_offset) {
- drive->sect0 = 63;
- drive->bios_cyl = (tracks - 1) / drive->bios_head;
+ if (offset) {
+#if FAKE_FDISK_FOR_EZDRIVE
+ if (offset == -1)
+ drive->ezdrive = 1;
+ else
+#endif /* FAKE_FDISK_FOR_EZDRIVE */
+ {
+ drive->sect0 = 63;
+ drive->bios_cyl = (tracks - 1) / drive->bios_head;
+ }
}
drive->part[0].nr_sects = current_capacity(drive);
- printk("%s [+%d,%d/%d/%d]", msg, drive->sect0, drive->bios_cyl, drive->bios_head, drive->bios_sect);
+ printk("%s [%d/%d/%d]", msg, drive->bios_cyl, drive->bios_head, drive->bios_sect);
return 1;
}

@@ -2824,11 +2842,17 @@
unsigned short reg;

printk("ide: buggy RZ1000 interface: ");
- if ((rc = pcibios_read_config_word(bus, fn, 0x40, &reg))
- || (rc = pcibios_write_config_word(bus, fn, 0x40, reg & 0xdfff)))
- buggy_interface_fallback (rc);
- else
- printk("disabled read-ahead\n");
+ if ((rc = pcibios_read_config_word (bus, fn, PCI_COMMAND, &reg))) {
+ ide_pci_access_error (rc);
+ } else if (!(reg & 1)) {
+ printk("not enabled\n");
+ } else {
+ if ((rc = pcibios_read_config_word(bus, fn, 0x40, &reg))
+ || (rc = pcibios_write_config_word(bus, fn, 0x40, reg & 0xdfff)))
+ buggy_interface_fallback (rc);
+ else
+ printk("disabled read-ahead\n");
+ }
}
#endif /* SUPPORT_RZ1000 */

@@ -2840,11 +2864,34 @@

single_threaded = 1;
printk("ide: buggy CMD640 interface: ");
+
+#if 0 /* funny.. the cmd640b I tried this on claimed to not be enabled.. */
+ unsigned short sreg;
+ if ((rc = pcibios_read_config_word (bus, fn, PCI_COMMAND, &sreg))) {
+ ide_pci_access_error (rc);
+ } else if (!(sreg & 1)) {
+ printk("not enabled\n");
+ } else {
+#endif /* 0 */
+
+ /*
+ * The first part is undocumented magic from the DOS driver.
+ * According to the datasheet, there is no port 0x5b on the cmd640.
+ */
+ (void) pcibios_write_config_byte(bus, fn, 0x5b, 0xbd);
+ if (pcibios_write_config_byte(bus, fn, 0x5b, 0xbd) != 0xbd)
+ printk("init_cmd640: huh? 0x5b read back wrong\n");
+ (void) pcibios_write_config_byte(bus, fn, 0x5b, 0);
+ /*
+ * The rest is from the cmd640b datasheet.
+ */
if ((rc = pcibios_read_config_byte(bus, fn, 0x51, &reg))
- || (rc = pcibios_write_config_byte(bus, fn, 0x51, reg | 0xc8)))
+ || (rc = pcibios_write_config_byte(bus, fn, 0x51, reg | 0xc0)) /* 0xc8 to enable 2nd i/f */
+ || (rc = pcibios_read_config_byte(bus, fn, 0x57, &reg))
+ || (rc = pcibios_write_config_byte(bus, fn, 0x57, reg | 0x0c)))
buggy_interface_fallback (rc);
else
- printk("serialized, disabled read-ahead, enabled secondary\n");
+ printk("serialized, disabled read-ahead\n");
}
#endif /* SUPPORT_CMD640 */

@@ -2857,19 +2904,13 @@
static void ide_probe_pci (unsigned short vendor, unsigned short device, ide_pci_init_proc_t *init)
{
unsigned long flags;
- unsigned index = 0;
+ unsigned index;
byte fn, bus;
- int rc;

save_flags(flags);
cli();
for (index = 0; !pcibios_find_device (vendor, device, index, &bus, &fn); ++index) {
- unsigned short command;
- if ((rc = pcibios_read_config_word (bus, fn, PCI_COMMAND, &command))) {
- ide_pci_access_error (rc);
- } else if (command & 1) { /* is device enabled? */
- init (bus, fn);
- }
+ init (bus, fn);
}
restore_flags(flags);
}
@@ -2889,7 +2930,7 @@
ide_probe_pci (PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_CMD_640, &init_cmd640);
#endif
#ifdef CONFIG_BLK_DEV_TRITON
- ide_probe_pci (PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371, &ide_init_triton);
+ ide_probe_pci (PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371_1, &ide_init_triton);
#endif
}
#endif /* CONFIG_PCI */
diff -u --recursive --new-file v1.3.27/linux/drivers/block/ide.h linux/drivers/block/ide.h
--- v1.3.27/linux/drivers/block/ide.h Thu Sep 7 17:17:17 1995
+++ linux/drivers/block/ide.h Fri Sep 15 14:38:20 1995
@@ -29,6 +29,9 @@
#ifndef OK_TO_RESET_CONTROLLER /* 1 needed for good error recovery */
#define OK_TO_RESET_CONTROLLER 1 /* 0 for use with AH2372A/B interface */
#endif
+#ifndef FAKE_FDISK_FOR_EZDRIVE /* 1 to help linux fdisk with EZDRIVE */
+#define FAKE_FDISK_FOR_EZDRIVE 1 /* 0 to reduce kernel size */
+#endif
#ifndef SUPPORT_RZ1000 /* 1 to support RZ1000 chipset */
#define SUPPORT_RZ1000 1 /* 0 to reduce kernel size */
#endif
@@ -248,6 +251,9 @@

typedef struct ide_drive_s {
special_t special; /* special action flags */
+#if FAKE_FDISK_FOR_EZDRIVE
+ unsigned ezdrive : 1; /* flag: partitioned with ezdrive */
+#endif /* FAKE_FDISK_FOR_EZDRIVE */
unsigned present : 1; /* drive is physically present */
unsigned noprobe : 1; /* from: hdx=noprobe */
unsigned keep_settings : 1; /* restore settings after drive reset */
diff -u --recursive --new-file v1.3.27/linux/drivers/block/triton.c linux/drivers/block/triton.c
--- v1.3.27/linux/drivers/block/triton.c Sun Sep 3 16:12:49 1995
+++ linux/drivers/block/triton.c Fri Sep 15 10:59:44 1995
@@ -292,7 +292,6 @@
unsigned int timings;
extern ide_hwif_t ide_hwifs[];

- ++fn; /* IDE interface is 2nd function on this device */
/*
* See if IDE and BM-DMA features are enabled:
*/
diff -u --recursive --new-file v1.3.27/linux/drivers/pci/pci.c linux/drivers/pci/pci.c
--- v1.3.27/linux/drivers/pci/pci.c Wed Sep 13 12:45:30 1995
+++ linux/drivers/pci/pci.c Fri Sep 15 10:59:44 1995
@@ -109,7 +109,7 @@
DEVICE( QLOGIC, QLOGIC_ISP1022, "ISP1022"),
DEVICE( LEADTEK, LEADTEK_805, "S3 805"),
DEVICE( CONTAQ, CONTAQ_82C599, "82C599"),
- DEVICE( CMD, CMD_640, "640A"),
+ DEVICE( CMD, CMD_640, "640 (buggy)"),
DEVICE( VISION, VISION_QD8500, "QD-8500"),
DEVICE( VISION, VISION_QD8580, "QD-8580"),
DEVICE( WINBOND, WINBOND_83769, "W83769F"),
@@ -150,9 +150,9 @@
BRIDGE( INTEL, INTEL_82434, "82434LX Mercury/Neptune", 0x00),
DEVICE( INTEL, INTEL_7116, "SAA7116"),
DEVICE( INTEL, INTEL_82865, "82865"),
- DEVICE( INTEL, INTEL_82437, "82437 Triton"),
- DEVICE( INTEL, INTEL_82371, "82371 Triton"),
- DEVICE( INTEL, INTEL_82438, "82438"),
+ DEVICE( INTEL, INTEL_82437, "82437"),
+ DEVICE( INTEL, INTEL_82371_0, "82371 Triton PIIX"),
+ DEVICE( INTEL, INTEL_82371_1, "82371 Triton PIIX"),
DEVICE( INTEL, INTEL_P6, "Experimental P6 bridge"),
DEVICE( ADAPTEC, ADAPTEC_7850, "AIC-7850"),
DEVICE( ADAPTEC, ADAPTEC_294x, "294x"),
diff -u --recursive --new-file v1.3.27/linux/drivers/scsi/53c7,8xx.c linux/drivers/scsi/53c7,8xx.c
--- v1.3.27/linux/drivers/scsi/53c7,8xx.c Sun Sep 3 12:26:55 1995
+++ linux/drivers/scsi/53c7,8xx.c Fri Sep 15 11:23:05 1995
@@ -987,7 +987,6 @@
int count; /* Number of boards detected */
unsigned char pci_bus, pci_device_fn;
static short pci_index=0; /* Device index to PCI BIOS calls */
-

for (current_override = count = 0; current_override < OVERRIDE_LIMIT;
++current_override) {
diff -u --recursive --new-file v1.3.27/linux/drivers/sound/Makefile linux/drivers/sound/Makefile
--- v1.3.27/linux/drivers/sound/Makefile Tue Aug 15 20:39:04 1995
+++ linux/drivers/sound/Makefile Fri Sep 15 10:59:43 1995
@@ -17,7 +17,13 @@
sys_timer.o ics2101.o ad1848.o pss.o sscape.o trix.o aedsp16.o \
mad16.o

+# Don't compile the sound driver during a normal kernel build if we have
+# configured for a module build instead.
+ifeq ($(CONFIG_SOUND),y)
all: local.h sound.a
+else
+all:
+endif

sound.a: $(OBJS)
-rm -f sound.a
diff -u --recursive --new-file v1.3.27/linux/drivers/sound/soundcard.c linux/drivers/sound/soundcard.c
--- v1.3.27/linux/drivers/sound/soundcard.c Tue Jul 11 10:02:54 1995
+++ linux/drivers/sound/soundcard.c Fri Sep 15 10:59:43 1995
@@ -438,6 +438,7 @@
int dev, ret = 0;
unsigned long dma_pagesize;
char *start_addr, *end_addr;
+ int order, size;
struct dma_buffparms *dmap;

for (dev = 0; dev < num_audiodevs; dev++)
@@ -497,8 +498,10 @@
}
}
#else
- start_addr = kmalloc (audio_devs[dev]->buffsize,
- GFP_DMA | GFP_KERNEL);
+ for (order = 0, size = PAGE_SIZE;
+ size < audio_devs[dev]->buffsize;
+ order++, size <<= 1);
+ start_addr = (char *) __get_free_pages(GFP_KERNEL, order, MAX_DMA_ADDRESS);
#endif
if (start_addr == NULL)
ret = -ENOMEM; /* Can't stop the loop in this case, because
@@ -545,8 +548,12 @@
}
#else
int dev, i;
+ int order, size;

- for (dev = 0; dev < num_audiodevs; dev++)
+ for (dev = 0; dev < num_audiodevs; dev++) {
+ for (order = 0, size = PAGE_SIZE;
+ size < audio_devs[dev]->buffsize;
+ order++, size <<= 1);
if (audio_devs[dev]->buffcount > 0 && audio_devs[dev]->dmachan >= 0)
{
for (i = 0; i < audio_devs[dev]->buffcount; i++)
@@ -555,9 +562,11 @@
if (debugmem)
printk ("sound: freeing 0x%lx\n",
(long) (audio_devs[dev]->dmap->raw_buf[i]));
- kfree (audio_devs[dev]->dmap->raw_buf[i]);
+ free_pages((unsigned long) audio_devs[dev]->dmap->raw_buf[i],
+ order);
}
}
+ }
#endif
}

diff -u --recursive --new-file v1.3.27/linux/fs/ioctl.c linux/fs/ioctl.c
--- v1.3.27/linux/fs/ioctl.c Fri Jun 2 15:56:27 1995
+++ linux/fs/ioctl.c Fri Sep 15 11:23:05 1995
@@ -50,7 +50,7 @@
return 0;
}
if (filp->f_op && filp->f_op->ioctl)
- return filp->f_op->ioctl(filp->f_inode, filp, cmd,arg);
+ return filp->f_op->ioctl(filp->f_inode, filp, cmd, arg);
return -EINVAL;
}

@@ -72,7 +72,7 @@
return 0;

case FIONBIO:
- on = get_fs_long((unsigned long *) arg);
+ on = get_user((unsigned int *) arg);
if (on)
filp->f_flags |= O_NONBLOCK;
else
@@ -81,7 +81,7 @@

case FIOASYNC: /* O_SYNC is not yet implemented,
but it's here for completeness. */
- on = get_fs_long ((unsigned long *) arg);
+ on = get_user ((unsigned int *) arg);
if (on)
filp->f_flags |= O_SYNC;
else
@@ -90,10 +90,10 @@

default:
if (filp->f_inode && S_ISREG(filp->f_inode->i_mode))
- return file_ioctl(filp,cmd,arg);
+ return file_ioctl(filp, cmd, arg);

if (filp->f_op && filp->f_op->ioctl)
- return filp->f_op->ioctl(filp->f_inode, filp, cmd,arg);
+ return filp->f_op->ioctl(filp->f_inode, filp, cmd, arg);

return -EINVAL;
}
diff -u --recursive --new-file v1.3.27/linux/fs/msdos/inode.c linux/fs/msdos/inode.c
--- v1.3.27/linux/fs/msdos/inode.c Tue Aug 8 12:31:39 1995
+++ linux/fs/msdos/inode.c Fri Sep 15 12:13:18 1995
@@ -168,7 +168,7 @@
{
struct buffer_head *bh;
struct msdos_boot_sector *b;
- int data_sectors,logical_sector_size,sector_mult;
+ int data_sectors,logical_sector_size,sector_mult,fat_clusters=0;
int debug,error,fat,quiet;
char check,conversion;
uid_t uid;
@@ -246,11 +246,12 @@
b->cluster_size/sector_mult : 0;
MSDOS_SB(sb)->fat_bits = fat ? fat : MSDOS_SB(sb)->clusters >
MSDOS_FAT12 ? 16 : 12;
+ fat_clusters = MSDOS_SB(sb)->fat_length*SECTOR_SIZE*8/
+ MSDOS_SB(sb)->fat_bits;
error = !MSDOS_SB(sb)->fats || (MSDOS_SB(sb)->dir_entries &
- (MSDOS_DPS-1)) || MSDOS_SB(sb)->clusters+2 > MSDOS_SB(sb)->
- fat_length*SECTOR_SIZE*8/MSDOS_SB(sb)->fat_bits ||
- (logical_sector_size & (SECTOR_SIZE-1)) || !b->secs_track ||
- !b->heads;
+ (MSDOS_DPS-1)) || MSDOS_SB(sb)->clusters+2 > fat_clusters+
+ MSDOS_MAX_EXTRA || (logical_sector_size & (SECTOR_SIZE-1))
+ || !b->secs_track || !b->heads;
}
brelse(bh);
/*
@@ -276,6 +277,8 @@
sectors),(unsigned long)b->total_sect,logical_sector_size);
printk ("Transaction block size = %d\n",blksize);
}
+ if (MSDOS_SB(sb)->clusters+2 > fat_clusters)
+ MSDOS_SB(sb)->clusters = fat_clusters-2;
if (error) {
if (!silent)
printk("VFS: Can't find a valid MSDOS filesystem on dev 0x%04x.\n",
diff -u --recursive --new-file v1.3.27/linux/fs/namei.c linux/fs/namei.c
--- v1.3.27/linux/fs/namei.c Tue Jun 27 14:11:43 1995
+++ linux/fs/namei.c Fri Sep 15 15:17:29 1995
@@ -122,14 +122,14 @@
*/
int get_write_access(struct inode * inode)
{
- struct task_struct ** p;
+ struct task_struct * p;

if ((inode->i_count > 1) && S_ISREG(inode->i_mode)) /* shortcut */
- for (p = &LAST_TASK ; p > &FIRST_TASK ; --p) {
+ for_each_task(p) {
struct vm_area_struct * mpnt;
- if (!*p)
+ if (!p->mm)
continue;
- for(mpnt = (*p)->mm->mmap; mpnt; mpnt = mpnt->vm_next) {
+ for(mpnt = p->mm->mmap; mpnt; mpnt = mpnt->vm_next) {
if (inode != mpnt->vm_inode)
continue;
if (mpnt->vm_flags & VM_DENYWRITE)
diff -u --recursive --new-file v1.3.27/linux/fs/proc/array.c linux/fs/proc/array.c
--- v1.3.27/linux/fs/proc/array.c Fri Sep 15 11:13:02 1995
+++ linux/fs/proc/array.c Fri Sep 15 11:23:05 1995
@@ -185,7 +185,7 @@
int i, len;
unsigned sum = 0;

- for (i = 0 ; i < 16 ; i++)
+ for (i = 0 ; i < NR_IRQS ; i++)
sum += kstat.interrupts[i];
len = sprintf(buffer,
"cpu %u %u %u %lu\n"
@@ -206,7 +206,7 @@
kstat.pswpin,
kstat.pswpout,
sum);
- for (i = 0 ; i < 16 ; i++)
+ for (i = 0 ; i < NR_IRQS ; i++)
len += sprintf(buffer + len, " %u", kstat.interrupts[i]);
len += sprintf(buffer + len,
"\nctxt %u\n"
diff -u --recursive --new-file v1.3.27/linux/fs/proc/fd.c linux/fs/proc/fd.c
--- v1.3.27/linux/fs/proc/fd.c Tue Aug 15 20:39:04 1995
+++ linux/fs/proc/fd.c Fri Sep 15 12:44:05 1995
@@ -150,6 +150,8 @@
}

for (fd -= 2 ; fd < NR_OPEN; fd++, filp->f_pos++) {
+ if (!p->files)
+ break;
if (!p->files->fd[fd] || !p->files->fd[fd]->f_inode)
continue;

diff -u --recursive --new-file v1.3.27/linux/fs/proc/link.c linux/fs/proc/link.c
--- v1.3.27/linux/fs/proc/link.c Tue Jun 27 14:11:43 1995
+++ linux/fs/proc/link.c Fri Sep 15 07:40:04 1995
@@ -128,13 +128,20 @@
new_inode = NULL;
switch (ino) {
case PROC_PID_CWD:
+ if (!p->fs)
+ break;
new_inode = p->fs->pwd;
break;
case PROC_PID_ROOT:
+ if (!p->fs)
+ break;
new_inode = p->fs->root;
break;
case PROC_PID_EXE: {
- struct vm_area_struct * vma = p->mm->mmap;
+ struct vm_area_struct * vma;
+ if (!p->mm)
+ break;
+ vma = p->mm->mmap;
while (vma) {
if (vma->vm_flags & VM_EXECUTABLE) {
new_inode = vma->vm_inode;
@@ -147,6 +154,8 @@
default:
switch (ino >> 8) {
case PROC_PID_FD_DIR:
+ if (!p->files)
+ break;
ino &= 0xff;
if (ino < NR_OPEN && p->files->fd[ino]) {
#ifdef PLAN9_SEMANTICS
diff -u --recursive --new-file v1.3.27/linux/include/asm-alpha/irq.h linux/include/asm-alpha/irq.h
--- v1.3.27/linux/include/asm-alpha/irq.h Fri Jun 2 13:51:16 1995
+++ linux/include/asm-alpha/irq.h Fri Sep 15 11:23:05 1995
@@ -8,6 +8,16 @@
*/

#include <linux/linkage.h>
+#include <linux/config.h>
+
+#if defined(CONFIG_ALPHA_CABRIOLET) || defined(CONFIG_ALPHA_EB66P)
+# define NR_IRQS 33
+#elif defined(CONFIG_ALPHA_EB66) || defined(CONFIG_ALPHA_EB64P)
+# define NR_IRQS 32
+#else
+# define NR_IRQS 16
+#endif
+

extern void disable_irq(unsigned int);
extern void enable_irq(unsigned int);
diff -u --recursive --new-file v1.3.27/linux/include/asm-i386/irq.h linux/include/asm-i386/irq.h
--- v1.3.27/linux/include/asm-i386/irq.h Thu Jun 29 19:02:55 1995
+++ linux/include/asm-i386/irq.h Fri Sep 15 11:29:46 1995
@@ -10,6 +10,8 @@
#include <linux/linkage.h>
#include <asm/segment.h>

+#define NR_IRQS 16
+
extern void disable_irq(unsigned int);
extern void enable_irq(unsigned int);

diff -u --recursive --new-file v1.3.27/linux/include/linux/kernel_stat.h linux/include/linux/kernel_stat.h
--- v1.3.27/linux/include/linux/kernel_stat.h Mon Mar 28 11:21:52 1994
+++ linux/include/linux/kernel_stat.h Fri Sep 15 11:29:55 1995
@@ -1,6 +1,8 @@
#ifndef _LINUX_KERNEL_STAT_H
#define _LINUX_KERNEL_STAT_H

+#include <asm/irq.h>
+
/*
* 'kernel_stat.h' contains the definitions needed for doing
* some kernel statistics (cpu usage, context switches ...),
@@ -14,7 +16,7 @@
unsigned int dk_drive[DK_NDRIVE];
unsigned int pgpgin, pgpgout;
unsigned int pswpin, pswpout;
- unsigned int interrupts[16];
+ unsigned int interrupts[NR_IRQS];
unsigned int ipackets, opackets;
unsigned int ierrors, oerrors;
unsigned int collisions;
diff -u --recursive --new-file v1.3.27/linux/include/linux/mc146818rtc.h linux/include/linux/mc146818rtc.h
--- v1.3.27/linux/include/linux/mc146818rtc.h Fri Feb 3 18:55:02 1995
+++ linux/include/linux/mc146818rtc.h Fri Sep 15 10:59:45 1995
@@ -14,17 +14,16 @@

#ifndef RTC_PORT
#define RTC_PORT(x) (0x70 + (x))
-#define RTC_ADDR(x) (0x80 | (x))
#define RTC_ALWAYS_BCD 1
#endif

#define CMOS_READ(addr) ({ \
-outb_p(RTC_ADDR(addr),RTC_PORT(0)); \
+outb_p((addr),RTC_PORT(0)); \
inb_p(RTC_PORT(1)); \
})
#define CMOS_WRITE(val, addr) ({ \
-outb_p(RTC_ADDR(addr),RTC_PORT(0)); \
-outb_p(val,RTC_PORT(1)); \
+outb_p((addr),RTC_PORT(0)); \
+outb_p((val),RTC_PORT(1)); \
})

/**********************************************************************
diff -u --recursive --new-file v1.3.27/linux/include/linux/module.h linux/include/linux/module.h
--- v1.3.27/linux/include/linux/module.h Wed Aug 2 13:21:16 1995
+++ linux/include/linux/module.h Fri Sep 15 11:23:05 1995
@@ -90,7 +90,7 @@
* define the count variable, and usage macros.
*/

-extern int mod_use_count_;
+extern long mod_use_count_;
#if defined(CONFIG_MODVERSIONS) && defined(MODULE) && !defined(__GENKSYMS__)
int Using_Versions; /* gcc will handle this global (used as a flag) correctly */
#endif
diff -u --recursive --new-file v1.3.27/linux/include/linux/msdos_fs.h linux/include/linux/msdos_fs.h
--- v1.3.27/linux/include/linux/msdos_fs.h Wed Aug 2 13:21:16 1995
+++ linux/include/linux/msdos_fs.h Fri Sep 15 10:59:43 1995
@@ -21,6 +21,9 @@

#define FAT_CACHE 8 /* FAT cache size */

+#define MSDOS_MAX_EXTRA 3 /* tolerate up to that number of clusters which are
+ inaccessible because the FAT is too short */
+
#define ATTR_RO 1 /* read-only */
#define ATTR_HIDDEN 2 /* hidden */
#define ATTR_SYS 4 /* system */
diff -u --recursive --new-file v1.3.27/linux/include/linux/pci.h linux/include/linux/pci.h
--- v1.3.27/linux/include/linux/pci.h Sat Sep 9 15:26:53 1995
+++ linux/include/linux/pci.h Fri Sep 15 10:59:45 1995
@@ -422,8 +422,8 @@
#define PCI_DEVICE_ID_INTEL_7116 0x1223
#define PCI_DEVICE_ID_INTEL_82865 0x1227
#define PCI_DEVICE_ID_INTEL_82437 0x122d
-#define PCI_DEVICE_ID_INTEL_82371 0x122e
-#define PCI_DEVICE_ID_INTEL_82438 0x1230
+#define PCI_DEVICE_ID_INTEL_82371_0 0x122e
+#define PCI_DEVICE_ID_INTEL_82371_1 0x1230
#define PCI_DEVICE_ID_INTEL_P6 0x84c4

#define PCI_VENDOR_ID_ADAPTEC 0x9004
diff -u --recursive --new-file v1.3.27/linux/include/linux/timex.h linux/include/linux/timex.h
--- v1.3.27/linux/include/linux/timex.h Sun Sep 3 12:27:03 1995
+++ linux/include/linux/timex.h Fri Sep 15 11:01:37 1995
@@ -16,18 +16,20 @@

/*
* Modification history timex.h
- *
+ *
* 17 Sep 93 David L. Mills
* Created file $NTP/include/sys/timex.h
* 07 Oct 93 Torsten Duwe
* Derived linux/timex.h
+ * 1995-08-13 Torsten Duwe
+ * kernel PLL updated to 1994-12-13 specs (rfc-1489)
*/
#ifndef _LINUX_TIMEX_H
#define _LINUX_TIMEX_H

/*
* The following defines establish the engineering parameters of the PLL
- * model. The HZ variable establishes the timer interrupt frequency, 100 Hz
+ * model. The HZ variable establishes the timer interrupt frequency, 100 Hz
* for the SunOS kernel, 256 Hz for the Ultrix kernel and 1024 Hz for the
* OSF/1 kernel. The SHIFT_HZ define expresses the same value as the
* nearest power of two in order to avoid hardware multiply operations.
@@ -39,14 +41,19 @@
#endif

/*
- * The SHIFT_KG and SHIFT_KF defines establish the damping of the PLL
- * and are chosen by analysis for a slightly underdamped convergence
- * characteristic. The MAXTC define establishes the maximum time constant
- * of the PLL. With the parameters given and the default time constant of
- * zero, the PLL will converge in about 15 minutes.
- */
-#define SHIFT_KG 8 /* shift for phase increment */
-#define SHIFT_KF 20 /* shift for frequency increment */
+ * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen
+ * for a slightly underdamped convergence characteristic. SHIFT_KH
+ * establishes the damping of the FLL and is chosen by wisdom and black
+ * art.
+ *
+ * MAXTC establishes the maximum time constant of the PLL. With the
+ * SHIFT_KG and SHIFT_KF values given and a time constant range from
+ * zero to MAXTC, the PLL will converge in 15 minutes to 16 hours,
+ * respectively.
+ */
+#define SHIFT_KG 6 /* phase factor (shift) */
+#define SHIFT_KF 16 /* PLL frequency factor (shift) */
+#define SHIFT_KH 2 /* FLL frequency factor (shift) */
#define MAXTC 6 /* maximum time constant (shift) */

/*
@@ -56,15 +63,47 @@
* point of the time_offset variable which represents the current offset
* with respect to standard time. The FINEUSEC define represents 1 usec in
* scaled units.
+ *
+ * SHIFT_USEC defines the scaling (shift) of the time_freq and
+ * time_tolerance variables, which represent the current frequency
+ * offset and maximum frequency tolerance.
*/
-#define SHIFT_SCALE 24 /* shift for phase scale factor */
+#define SHIFT_SCALE 22 /* shift for phase scale factor */
#define SHIFT_UPDATE (SHIFT_KG + MAXTC) /* shift for offset scale factor */
-#define FINEUSEC (1 << SHIFT_SCALE) /* 1 us in scaled units */
+#define SHIFT_USEC 16 /* frequency offset scale (shift) */
+#define FINEUSEC (1L << SHIFT_SCALE) /* 1 us in phase units */

-#define MAXPHASE 128000 /* max phase error (us) */
-#define MAXFREQ 100 /* max frequency error (ppm) */
-#define MINSEC 16 /* min interval between updates (s) */
-#define MAXSEC 1200 /* max interval between updates (s) */
+#define MAXPHASE 512000L /* max phase error (us) */
+#define MAXFREQ (512000L << SHIFT_USEC) /* max frequency error (ppm) */
+#define MAXTIME (200L << PPS_AVG) /* max PPS error (jitter) (200 us) */
+#define MINSEC 16L /* min interval between updates (s) */
+#define MAXSEC 1200L /* max interval between updates (s) */
+
+/*
+ * The following defines are used only if a pulse-per-second (PPS)
+ * signal is available and connected via a modem control lead, such as
+ * produced by the optional ppsclock feature incorporated in the Sun
+ * asynch driver. They establish the design parameters of the frequency-
+ * lock loop used to discipline the CPU clock oscillator to the PPS
+ * signal.
+ *
+ * PPS_AVG is the averaging factor for the frequency loop, as well as
+ * the time and frequency dispersion.
+ *
+ * PPS_SHIFT and PPS_SHIFTMAX specify the minimum and maximum
+ * calibration intervals, respectively, in seconds as a power of two.
+ *
+ * PPS_VALID is the maximum interval before the PPS signal is considered
+ * invalid and protocol updates used directly instead.
+ *
+ * MAXGLITCH is the maximum interval before a time offset of more than
+ * MAXTIME is believed.
+ */
+#define PPS_AVG 2 /* pps averaging constant (shift) */
+#define PPS_SHIFT 2 /* min interval duration (s) (shift) */
+#define PPS_SHIFTMAX 8 /* max interval duration (s) (shift) */
+#define PPS_VALID 120 /* pps signal watchdog max (s) */
+#define MAXGLITCH 30 /* pps signal glitch max (s) */

#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */
#define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */
@@ -79,13 +118,13 @@
* to discipline kernel clock oscillator
*/
struct timex {
- int mode; /* mode selector */
+ unsigned int modes; /* mode selector */
long offset; /* time offset (usec) */
- long frequency; /* frequency offset (scaled ppm) */
+ long freq; /* frequency offset (scaled ppm) */
long maxerror; /* maximum error (usec) */
long esterror; /* estimated error (usec) */
int status; /* clock command/status */
- long time_constant; /* pll time constant */
+ long constant; /* pll time constant */
long precision; /* clock precision (usec) (read only) */
long tolerance; /* clock frequency tolerance (ppm)
* (read only)
@@ -108,7 +147,7 @@
};

/*
- * Mode codes (timex.mode)
+ * Mode codes (timex.mode)
*/
#define ADJ_OFFSET 0x0001 /* time offset */
#define ADJ_FREQUENCY 0x0002 /* frequency offset */
@@ -119,14 +158,47 @@
#define ADJ_TICK 0x4000 /* tick value */
#define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */

+/* xntp 3.4 compatibility names */
+#define MOD_OFFSET ADJ_OFFSET
+#define MOD_FREQUENCY ADJ_FREQUENCY
+#define MOD_MAXERROR ADJ_MAXERROR
+#define MOD_ESTERROR ADJ_ESTERROR
+#define MOD_STATUS ADJ_STATUS
+#define MOD_TIMECONST ADJ_TIMECONST
+
+/*
+ * Status codes (timex.status)
+ */
+#define STA_PLL 0x0001 /* enable PLL updates (rw) */
+#define STA_PPSFREQ 0x0002 /* enable PPS freq discipline (rw) */
+#define STA_PPSTIME 0x0004 /* enable PPS time discipline (rw) */
+#define STA_FLL 0x0008 /* select frequency-lock mode (rw) */
+
+#define STA_INS 0x0010 /* insert leap (rw) */
+#define STA_DEL 0x0020 /* delete leap (rw) */
+#define STA_UNSYNC 0x0040 /* clock unsynchronized (rw) */
+#define STA_FREQHOLD 0x0080 /* hold frequency (rw) */
+
+#define STA_PPSSIGNAL 0x0100 /* PPS signal present (ro) */
+#define STA_PPSJITTER 0x0200 /* PPS signal jitter exceeded (ro) */
+#define STA_PPSWANDER 0x0400 /* PPS signal wander exceeded (ro) */
+#define STA_PPSERROR 0x0800 /* PPS signal calibration error (ro) */
+
+#define STA_CLOCKERR 0x1000 /* clock hardware fault (ro) */
+
+#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \
+ STA_PPSERROR | STA_CLOCKERR) /* read-only bits */
+
/*
- * Clock command/status codes (timex.status)
+ * Clock states (time_state)
*/
#define TIME_OK 0 /* clock synchronized */
#define TIME_INS 1 /* insert leap second */
#define TIME_DEL 2 /* delete leap second */
#define TIME_OOP 3 /* leap second in progress */
-#define TIME_BAD 4 /* clock not synchronized */
+#define TIME_WAIT 4 /* leap second has occured */
+#define TIME_ERROR 5 /* clock not synchronized */
+#define TIME_BAD TIME_ERROR /* bw compat */

#ifdef __KERNEL__
/*
@@ -138,19 +210,36 @@
/*
* phase-lock loop variables
*/
-extern int time_status; /* clock synchronization status */
+extern int time_state; /* clock status */
+extern int time_status; /* clock synchronization status bits */
extern long time_offset; /* time adjustment (us) */
extern long time_constant; /* pll time constant */
extern long time_tolerance; /* frequency tolerance (ppm) */
extern long time_precision; /* clock precision (us) */
extern long time_maxerror; /* maximum error */
extern long time_esterror; /* estimated error */
+
extern long time_phase; /* phase offset (scaled us) */
extern long time_freq; /* frequency offset (scaled ppm) */
extern long time_adj; /* tick adjust (scaled 1 / HZ) */
extern long time_reftime; /* time at last adjustment (s) */

extern long time_adjust; /* The amount of adjtime left */
+
+/* interface variables pps->timer interrupt */
+extern long pps_offset; /* pps time offset (us) */
+extern long pps_jitter; /* time dispersion (jitter) (us) */
+extern long pps_freq; /* frequency offset (scaled ppm) */
+extern long pps_stabil; /* frequency dispersion (scaled ppm) */
+extern long pps_valid; /* pps signal watchdog counter */
+
+/* interface variables pps->adjtimex */
+extern int pps_shift; /* interval duration (s) (shift) */
+extern long pps_jitcnt; /* jitter limit exceeded */
+extern long pps_calcnt; /* calibration intervals */
+extern long pps_errcnt; /* calibration errors */
+extern long pps_stbcnt; /* stability limit exceeded */
+
#endif /* KERNEL */

#endif /* LINUX_TIMEX_H */
diff -u --recursive --new-file v1.3.27/linux/include/linux/user.h linux/include/linux/user.h
--- v1.3.27/linux/include/linux/user.h Sun Sep 3 12:27:03 1995
+++ linux/include/linux/user.h Fri Sep 15 07:47:25 1995
@@ -1,6 +1,7 @@
#ifndef _LINUX_USER_H
#define _LINUX_USER_H

+#include <asm/page.h>
#include <linux/ptrace.h>
/* Core file format: The core file is written in such a way that gdb
can understand it and provide useful information to the user (under
diff -u --recursive --new-file v1.3.27/linux/kernel/exit.c linux/kernel/exit.c
--- v1.3.27/linux/kernel/exit.c Fri Sep 15 11:13:03 1995
+++ linux/kernel/exit.c Fri Sep 15 11:23:05 1995
@@ -63,8 +63,7 @@
p->signal &= ~( (1<<(SIGSTOP-1)) | (1<<(SIGTSTP-1)) |
(1<<(SIGTTIN-1)) | (1<<(SIGTTOU-1)) );
}
- /* Depends on order SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU */
- if ((sig >= SIGSTOP) && (sig <= SIGTTOU))
+ if (sig == SIGSTOP || sig == SIGTSTP || sig == SIGTTIN || sig == SIGTTOU)
p->signal &= ~(1<<(SIGCONT-1));
/* Actually generate the signal */
generate(sig,p);
diff -u --recursive --new-file v1.3.27/linux/kernel/fork.c linux/kernel/fork.c
--- v1.3.27/linux/kernel/fork.c Fri Sep 15 11:13:03 1995
+++ linux/kernel/fork.c Fri Sep 15 15:29:46 1995
@@ -31,34 +31,34 @@

static int find_empty_process(void)
{
- int free_task;
- int i, tasks_free;
+ int i;
int this_user_tasks;
+ struct task_struct *p;

+ if (nr_tasks >= NR_TASKS - MIN_TASKS_LEFT_FOR_ROOT) {
+ if (current->uid)
+ return -EAGAIN;
+ }
repeat:
if ((++last_pid) & 0xffff8000)
last_pid=1;
this_user_tasks = 0;
- tasks_free = 0;
- free_task = -EAGAIN;
- i = NR_TASKS;
- while (--i > 0) {
- if (!task[i]) {
- free_task = i;
- tasks_free++;
- continue;
- }
- if (task[i]->uid == current->uid)
+ for_each_task (p) {
+ if (p->uid == current->uid)
this_user_tasks++;
- if (task[i]->pid == last_pid || task[i]->pgrp == last_pid ||
- task[i]->session == last_pid)
+ if (p->pid == last_pid ||
+ p->pgrp == last_pid ||
+ p->session == last_pid)
goto repeat;
}
- if (tasks_free <= MIN_TASKS_LEFT_FOR_ROOT ||
- this_user_tasks > current->rlim[RLIMIT_NPROC].rlim_cur)
+ if (this_user_tasks > current->rlim[RLIMIT_NPROC].rlim_cur)
if (current->uid)
return -EAGAIN;
- return free_task;
+ for (i = 0 ; i < NR_TASKS ; i++) {
+ if (!task[i])
+ return i;
+ }
+ return -EAGAIN;
}

static int dup_mmap(struct mm_struct * mm)
diff -u --recursive --new-file v1.3.27/linux/kernel/info.c linux/kernel/info.c
--- v1.3.27/linux/kernel/info.c Wed Dec 1 14:44:15 1993
+++ linux/kernel/info.c Fri Sep 15 15:16:36 1995
@@ -18,7 +18,6 @@
{
int error;
struct sysinfo val;
- struct task_struct **p;

error = verify_area(VERIFY_WRITE, info, sizeof(struct sysinfo));
if (error)
@@ -31,8 +30,7 @@
val.loads[1] = avenrun[1] << (SI_LOAD_SHIFT - FSHIFT);
val.loads[2] = avenrun[2] << (SI_LOAD_SHIFT - FSHIFT);

- for (p = &LAST_TASK; p > &FIRST_TASK; p--)
- if (*p) val.procs++;
+ val.procs = nr_tasks-1;

si_meminfo(&val);
si_swapinfo(&val);
diff -u --recursive --new-file v1.3.27/linux/kernel/sched.c linux/kernel/sched.c
--- v1.3.27/linux/kernel/sched.c Wed Sep 13 12:45:33 1995
+++ linux/kernel/sched.c Fri Sep 15 10:59:45 1995
@@ -50,7 +50,8 @@
/*
* phase-lock loop variables
*/
-int time_status = TIME_BAD; /* clock synchronization status */
+int time_state = TIME_BAD; /* clock synchronization status */
+int time_status = STA_UNSYNC; /* clock status bits */
long time_offset = 0; /* time adjustment (us) */
long time_constant = 0; /* pll time constant */
long time_tolerance = MAXFREQ; /* frequency tolerance (ppm) */
@@ -474,57 +475,117 @@
* They were originally developed for SUN and DEC kernels.
* All the kudos should go to Dave for this stuff.
*
- * These were ported to Linux by Philip Gladstone.
*/
static void second_overflow(void)
{
- long ltemp;
+ long ltemp;

- /* Bump the maxerror field */
- time_maxerror = (0x70000000-time_maxerror < time_tolerance) ?
- 0x70000000 : (time_maxerror + time_tolerance);
-
- /* Run the PLL */
- if (time_offset < 0) {
- ltemp = (-(time_offset+1) >> (SHIFT_KG + time_constant)) + 1;
- time_adj = ltemp << (SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE);
- time_offset += (time_adj * HZ) >> (SHIFT_SCALE - SHIFT_UPDATE);
- time_adj = - time_adj;
- } else if (time_offset > 0) {
- ltemp = ((time_offset-1) >> (SHIFT_KG + time_constant)) + 1;
- time_adj = ltemp << (SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE);
- time_offset -= (time_adj * HZ) >> (SHIFT_SCALE - SHIFT_UPDATE);
- } else {
- time_adj = 0;
- }
-
- time_adj += (time_freq >> (SHIFT_KF + SHIFT_HZ - SHIFT_SCALE))
- + FINETUNE;
-
- /* Handle the leap second stuff */
- switch (time_status) {
- case TIME_INS:
- /* ugly divide should be replaced */
- if (xtime.tv_sec % 86400 == 0) {
- xtime.tv_sec--; /* !! */
- time_status = TIME_OOP;
- printk("Clock: inserting leap second 23:59:60 UTC\n");
- }
- break;
-
- case TIME_DEL:
- /* ugly divide should be replaced */
- if (xtime.tv_sec % 86400 == 86399) {
- xtime.tv_sec++;
- time_status = TIME_OK;
- printk("Clock: deleting leap second 23:59:59 UTC\n");
- }
- break;
+ /* Bump the maxerror field */
+ time_maxerror = (0x70000000-time_maxerror <
+ time_tolerance >> SHIFT_USEC) ?
+ 0x70000000 : (time_maxerror + (time_tolerance >> SHIFT_USEC));
+
+ /*
+ * Leap second processing. If in leap-insert state at
+ * the end of the day, the system clock is set back one
+ * second; if in leap-delete state, the system clock is
+ * set ahead one second. The microtime() routine or
+ * external clock driver will insure that reported time
+ * is always monotonic. The ugly divides should be
+ * replaced.
+ */
+ switch (time_state) {
+
+ case TIME_OK:
+ if (time_status & STA_INS)
+ time_state = TIME_INS;
+ else if (time_status & STA_DEL)
+ time_state = TIME_DEL;
+ break;
+
+ case TIME_INS:
+ if (xtime.tv_sec % 86400 == 0) {
+ xtime.tv_sec--;
+ time_state = TIME_OOP;
+ printk("Clock: inserting leap second 23:59:60 UTC\n");
+ }
+ break;

- case TIME_OOP:
- time_status = TIME_OK;
- break;
+ case TIME_DEL:
+ if ((xtime.tv_sec + 1) % 86400 == 0) {
+ xtime.tv_sec++;
+ time_state = TIME_WAIT;
+ printk("Clock: deleting leap second 23:59:59 UTC\n");
}
+ break;
+
+ case TIME_OOP:
+ time_state = TIME_WAIT;
+ break;
+
+ case TIME_WAIT:
+ if (!(time_status & (STA_INS | STA_DEL)))
+ time_state = TIME_OK;
+ }
+
+ /*
+ * Compute the phase adjustment for the next second. In
+ * PLL mode, the offset is reduced by a fixed factor
+ * times the time constant. In FLL mode the offset is
+ * used directly. In either mode, the maximum phase
+ * adjustment for each second is clamped so as to spread
+ * the adjustment over not more than the number of
+ * seconds between updates.
+ */
+ if (time_offset < 0) {
+ ltemp = -time_offset;
+ if (!(time_status & STA_FLL))
+ ltemp >>= SHIFT_KG + time_constant;
+ if (ltemp > (MAXPHASE / MINSEC) << SHIFT_UPDATE)
+ ltemp = (MAXPHASE / MINSEC) <<
+ SHIFT_UPDATE;
+ time_offset += ltemp;
+ time_adj = -ltemp << (SHIFT_SCALE - SHIFT_HZ -
+ SHIFT_UPDATE);
+ } else {
+ ltemp = time_offset;
+ if (!(time_status & STA_FLL))
+ ltemp >>= SHIFT_KG + time_constant;
+ if (ltemp > (MAXPHASE / MINSEC) << SHIFT_UPDATE)
+ ltemp = (MAXPHASE / MINSEC) <<
+ SHIFT_UPDATE;
+ time_offset -= ltemp;
+ time_adj = ltemp << (SHIFT_SCALE - SHIFT_HZ -
+ SHIFT_UPDATE);
+ }
+
+ /*
+ * Compute the frequency estimate and additional phase
+ * adjustment due to frequency error for the next
+ * second. When the PPS signal is engaged, gnaw on the
+ * watchdog counter and update the frequency computed by
+ * the pll and the PPS signal.
+ */
+ pps_valid++;
+ if (pps_valid == PPS_VALID) {
+ pps_jitter = MAXTIME;
+ pps_stabil = MAXFREQ;
+ time_status &= ~(STA_PPSSIGNAL | STA_PPSJITTER |
+ STA_PPSWANDER | STA_PPSERROR);
+ }
+ ltemp = time_freq + pps_freq;
+ if (ltemp < 0)
+ time_adj -= -ltemp >>
+ (SHIFT_USEC + SHIFT_HZ - SHIFT_SCALE);
+ else
+ time_adj += ltemp >>
+ (SHIFT_USEC + SHIFT_HZ - SHIFT_SCALE);
+
+ /* compensate for (HZ==100) != 128. Add 25% to get 125; => only 3% error */
+ if (time_adj < 0)
+ time_adj -= -time_adj >> 2;
+ else
+ time_adj += time_adj >> 2;
}

/*
@@ -592,12 +653,12 @@
* advance the tick more.
*/
time_phase += time_adj;
- if (time_phase < -FINEUSEC) {
+ if (time_phase <= -FINEUSEC) {
ltemp = -time_phase >> SHIFT_SCALE;
time_phase += ltemp << SHIFT_SCALE;
xtime.tv_usec += tick + time_adjust_step - ltemp;
}
- else if (time_phase > FINEUSEC) {
+ else if (time_phase >= FINEUSEC) {
ltemp = time_phase >> SHIFT_SCALE;
time_phase -= ltemp << SHIFT_SCALE;
xtime.tv_usec += tick + time_adjust_step + ltemp;
@@ -638,7 +699,7 @@
* CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
* called as close as possible to 500 ms before the new second starts.
*/
- if (time_status != TIME_BAD && xtime.tv_sec > last_rtc_update + 660 &&
+ if (time_state != TIME_BAD && xtime.tv_sec > last_rtc_update + 660 &&
xtime.tv_usec > 500000 - (tick >> 1) &&
xtime.tv_usec < 500000 + (tick >> 1))
if (set_rtc_mmss(xtime.tv_sec) == 0)
diff -u --recursive --new-file v1.3.27/linux/kernel/sys.c linux/kernel/sys.c
--- v1.3.27/linux/kernel/sys.c Fri Sep 15 11:13:03 1995
+++ linux/kernel/sys.c Fri Sep 15 15:15:25 1995
@@ -56,7 +56,7 @@

asmlinkage int sys_setpriority(int which, int who, int niceval)
{
- struct task_struct **p;
+ struct task_struct *p;
int error = ESRCH;
int priority;

@@ -66,39 +66,39 @@
if ((priority = PZERO - niceval) <= 0)
priority = 1;

- for(p = &LAST_TASK; p > &FIRST_TASK; --p) {
- if (!*p || !proc_sel(*p, which, who))
+ for_each_task(p) {
+ if (!proc_sel(p, which, who))
continue;
- if ((*p)->uid != current->euid &&
- (*p)->uid != current->uid && !suser()) {
+ if (p->uid != current->euid &&
+ p->uid != current->uid && !suser()) {
error = EPERM;
continue;
}
if (error == ESRCH)
error = 0;
- if (priority > (*p)->priority && !suser())
+ if (priority > p->priority && !suser())
error = EACCES;
else
- (*p)->priority = priority;
+ p->priority = priority;
}
return -error;
}

asmlinkage int sys_getpriority(int which, int who)
{
- struct task_struct **p;
- int max_prio = 0;
+ struct task_struct *p;
+ int max_prio = -ESRCH;

if (which > 2 || which < 0)
return -EINVAL;

- for(p = &LAST_TASK; p > &FIRST_TASK; --p) {
- if (!*p || !proc_sel(*p, which, who))
+ for_each_task (p) {
+ if (!proc_sel(p, which, who))
continue;
- if ((*p)->priority > max_prio)
- max_prio = (*p)->priority;
+ if (p->priority > max_prio)
+ max_prio = p->priority;
}
- return(max_prio ? max_prio : -ESRCH);
+ return max_prio;
}

asmlinkage int sys_profil(void)
diff -u --recursive --new-file v1.3.27/linux/kernel/time.c linux/kernel/time.c
--- v1.3.27/linux/kernel/time.c Sun Sep 3 12:27:04 1995
+++ linux/kernel/time.c Fri Sep 15 10:59:45 1995
@@ -19,10 +19,8 @@
* 1995-03-26 Markus Kuhn
* fixed 500 ms bug at call to set_rtc_mmss, fixed DS12887
* precision CMOS clock update
- *
- * to do: adjtimex() has to be updated to recent (1994-12-13) revision
- * of David Mill's kernel clock model. For more information, check
- * <ftp://louie.udel.edu/pub/ntp/kernel.tar.Z>.
+ * 1995-08-13 Torsten Duwe
+ * kernel PLL updated to 1994-12-13 specs (rfc-1489)
*/

#include <linux/errno.h>
@@ -150,7 +148,7 @@
cli();
xtime.tv_sec = value;
xtime.tv_usec = 0;
- time_status = TIME_BAD;
+ time_state = TIME_BAD;
time_maxerror = 0x70000000;
time_esterror = 0x70000000;
sti();
@@ -330,7 +328,7 @@
}

xtime = new_tv;
- time_status = TIME_BAD;
+ time_state = TIME_BAD;
time_maxerror = 0x70000000;
time_esterror = 0x70000000;
sti();
@@ -338,6 +336,24 @@
return 0;
}

+long pps_offset = 0; /* pps time offset (us) */
+long pps_jitter = MAXTIME; /* time dispersion (jitter) (us) */
+
+long pps_freq = 0; /* frequency offset (scaled ppm) */
+long pps_stabil = MAXFREQ; /* frequency dispersion (scaled ppm) */
+
+long pps_valid = PPS_VALID; /* pps signal watchdog counter */
+
+int pps_shift = PPS_SHIFT; /* interval duration (s) (shift) */
+
+long pps_jitcnt = 0; /* jitter limit exceeded */
+long pps_calcnt = 0; /* calibration intervals */
+long pps_errcnt = 0; /* calibration errors */
+long pps_stbcnt = 0; /* stability limit exceeded */
+
+/* hook for a loadable hardpps kernel module */
+void (*hardpps_ptr)(struct timeval *) = (void (*)(struct timeval *))0;
+
/* adjtimex mainly allows reading (and writing, if superuser) of
* kernel time-keeping variables. used by xntpd.
*/
@@ -360,25 +376,19 @@
memcpy_fromfs(&txc, txc_p, sizeof(struct timex));

/* In order to modify anything, you gotta be super-user! */
- if (txc.mode && !suser())
+ if (txc.modes && !suser())
return -EPERM;

/* Now we validate the data before disabling interrupts
*/

- if (txc.mode != ADJ_OFFSET_SINGLESHOT && (txc.mode & ADJ_OFFSET))
- /* Microsec field limited to -131000 .. 131000 usecs */
- if (txc.offset <= -(1 << (31 - SHIFT_UPDATE))
- || txc.offset >= (1 << (31 - SHIFT_UPDATE)))
- return -EINVAL;
-
- /* time_status must be in a fairly small range */
- if (txc.mode & ADJ_STATUS)
- if (txc.status < TIME_OK || txc.status > TIME_BAD)
+ if (txc.modes != ADJ_OFFSET_SINGLESHOT && (txc.modes & ADJ_OFFSET))
+ /* adjustment Offset limited to +- .512 seconds */
+ if (txc.offset <= - MAXPHASE || txc.offset >= MAXPHASE )
return -EINVAL;

/* if the quartz is off by more than 10% something is VERY wrong ! */
- if (txc.mode & ADJ_TICK)
+ if (txc.modes & ADJ_TICK)
if (txc.tick < 900000/HZ || txc.tick > 1100000/HZ)
return -EINVAL;

@@ -388,72 +398,118 @@
save_adjust = time_adjust;

/* If there are input parameters, then process them */
- if (txc.mode)
+ if (txc.modes)
{
- if (time_status == TIME_BAD)
- time_status = TIME_OK;
+ if (time_state == TIME_BAD)
+ time_state = TIME_OK;

- if (txc.mode & ADJ_STATUS)
+ if (txc.modes & ADJ_STATUS)
time_status = txc.status;

- if (txc.mode & ADJ_FREQUENCY)
- time_freq = txc.frequency << (SHIFT_KF - 16);
+ if (txc.modes & ADJ_FREQUENCY)
+ time_freq = txc.freq;

- if (txc.mode & ADJ_MAXERROR)
+ if (txc.modes & ADJ_MAXERROR)
time_maxerror = txc.maxerror;

- if (txc.mode & ADJ_ESTERROR)
+ if (txc.modes & ADJ_ESTERROR)
time_esterror = txc.esterror;

- if (txc.mode & ADJ_TIMECONST)
- time_constant = txc.time_constant;
+ if (txc.modes & ADJ_TIMECONST)
+ time_constant = txc.constant;

- if (txc.mode & ADJ_OFFSET)
- if (txc.mode == ADJ_OFFSET_SINGLESHOT)
+ if (txc.modes & ADJ_OFFSET)
+ if ((txc.modes == ADJ_OFFSET_SINGLESHOT)
+ || !(time_status & STA_PLL))
{
time_adjust = txc.offset;
}
- else /* XXX should give an error if other bits set */
+ else if ((time_status & STA_PLL)||(time_status & STA_PPSTIME))
{
- time_offset = txc.offset << SHIFT_UPDATE;
- mtemp = xtime.tv_sec - time_reftime;
- time_reftime = xtime.tv_sec;
- if (mtemp > (MAXSEC+2) || mtemp < 0)
- mtemp = 0;
-
- if (txc.offset < 0)
- time_freq -= (-txc.offset * mtemp) >>
- (time_constant + time_constant);
+ ltemp = (time_status & STA_PPSTIME &&
+ time_status & STA_PPSSIGNAL) ?
+ pps_offset : txc.offset;
+
+ /*
+ * Scale the phase adjustment and
+ * clamp to the operating range.
+ */
+ if (ltemp > MAXPHASE)
+ time_offset = MAXPHASE << SHIFT_UPDATE;
+ else if (ltemp < -MAXPHASE)
+ time_offset = -(MAXPHASE << SHIFT_UPDATE);
else
- time_freq += (txc.offset * mtemp) >>
- (time_constant + time_constant);
+ time_offset = ltemp << SHIFT_UPDATE;

- ltemp = time_tolerance << SHIFT_KF;
+ /*
+ * Select whether the frequency is to be controlled and in which
+ * mode (PLL or FLL). Clamp to the operating range. Ugly
+ * multiply/divide should be replaced someday.
+ */

- if (time_freq > ltemp)
- time_freq = ltemp;
- else if (time_freq < -ltemp)
- time_freq = -ltemp;
+ if (time_status & STA_FREQHOLD || time_reftime == 0)
+ time_reftime = xtime.tv_sec;
+ mtemp = xtime.tv_sec - time_reftime;
+ time_reftime = xtime.tv_sec;
+ if (time_status & STA_FLL)
+ {
+ if (mtemp >= MINSEC)
+ {
+ ltemp = ((time_offset / mtemp) << (SHIFT_USEC -
+ SHIFT_UPDATE));
+ if (ltemp < 0)
+ time_freq -= -ltemp >> SHIFT_KH;
+ else
+ time_freq += ltemp >> SHIFT_KH;
+ }
+ }
+ else
+ {
+ if (mtemp < MAXSEC)
+ {
+ ltemp *= mtemp;
+ if (ltemp < 0)
+ time_freq -= -ltemp >> (time_constant +
+ time_constant + SHIFT_KF -
+ SHIFT_USEC);
+ else
+ time_freq += ltemp >> (time_constant +
+ time_constant + SHIFT_KF -
+ SHIFT_USEC);
+ }
+ }
+ if (time_freq > time_tolerance)
+ time_freq = time_tolerance;
+ else if (time_freq < -time_tolerance)
+ time_freq = -time_tolerance;
}
- if (txc.mode & ADJ_TICK)
+ if (txc.modes & ADJ_TICK)
tick = txc.tick;

}
txc.offset = save_adjust;
- txc.frequency = ((time_freq+1) >> (SHIFT_KF - 16));
+ txc.freq = time_freq;
txc.maxerror = time_maxerror;
txc.esterror = time_esterror;
txc.status = time_status;
- txc.time_constant = time_constant;
+ txc.constant = time_constant;
txc.precision = time_precision;
txc.tolerance = time_tolerance;
txc.time = xtime;
txc.tick = tick;
+ txc.ppsfreq = pps_freq;
+ txc.jitter = pps_jitter;
+ txc.shift = pps_shift;
+ txc.stabil = pps_stabil;
+ txc.jitcnt = pps_jitcnt;
+ txc.calcnt = pps_calcnt;
+ txc.errcnt = pps_errcnt;
+ txc.stbcnt = pps_stbcnt;

sti();

memcpy_tofs(txc_p, &txc, sizeof(struct timex));
- return time_status;
+ return time_state;
}

/*
diff -u --recursive --new-file v1.3.27/linux/mm/vmalloc.c linux/mm/vmalloc.c
--- v1.3.27/linux/mm/vmalloc.c Thu Sep 7 17:17:20 1995
+++ linux/mm/vmalloc.c Fri Sep 15 11:44:19 1995
@@ -31,8 +31,11 @@
{
struct task_struct * p;

- for_each_task(p)
+ for_each_task(p) {
+ if (!p->mm)
+ continue;
*pgd_offset(p->mm,address) = entry;
+ }
}

static inline void free_area_pte(pmd_t * pmd, unsigned long address, unsigned long size)
diff -u --recursive --new-file v1.3.27/linux/scripts/Configure linux/scripts/Configure
--- v1.3.27/linux/scripts/Configure Thu Sep 7 17:17:21 1995
+++ linux/scripts/Configure Fri Sep 15 10:59:44 1995
@@ -248,9 +248,9 @@
fi
. $CONFIG_IN

-if [ "$CONFIG_SOUND" = "y" ] ; then
- $MAKE -C drivers/sound config || exit 1
-fi
+case "$CONFIG_SOUND" in
+ [YyMm] ) $MAKE -C drivers/sound config || exit 1 ;;
+esac

rm -f .config.old
if [ -f .config ]; then
----------