]> git.neil.brown.name Git - history.git/commitdiff
Import 1.1.85 1.1.85
authorLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:09:52 +0000 (15:09 -0500)
committerLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:09:52 +0000 (15:09 -0500)
201 files changed:
CREDITS
Makefile
README.modules [new file with mode: 0644]
arch/alpha/boot/main.c
arch/alpha/kernel/irq.c
arch/alpha/mm/fault.c
arch/alpha/mm/init.c
arch/i386/config.in
arch/i386/kernel/bios32.c
arch/i386/kernel/ldt.c
arch/i386/kernel/signal.c
arch/i386/kernel/traps.c
arch/i386/kernel/vm86.c
arch/i386/math-emu/fpu_system.h
arch/i386/mm/init.c
arch/mips/kernel/signal.c
arch/mips/mm/fault.c
arch/mips/mm/init.c
arch/sparc/Makefile
arch/sparc/config.in
arch/sparc/kernel/Makefile
arch/sparc/kernel/entry.S
arch/sparc/kernel/head.S
arch/sparc/kernel/idprom.c [new file with mode: 0644]
arch/sparc/kernel/ioport.c
arch/sparc/kernel/probe.c [new file with mode: 0644]
arch/sparc/kernel/process.c
arch/sparc/kernel/promops.c
arch/sparc/kernel/setup.c [new file with mode: 0644]
arch/sparc/kernel/signal.c
arch/sparc/lib/Makefile
arch/sparc/lib/ashrdi3.S
arch/sparc/mm/Makefile
arch/sparc/mm/fault.c
arch/sparc/mm/init.c [new file with mode: 0644]
drivers/block/aztcd.c
drivers/block/ll_rw_blk.c
drivers/block/mcd.c
drivers/block/ramdisk.c
drivers/block/sbpcd.c
drivers/block/xd.c
drivers/char/Makefile
drivers/char/busmouse.c
drivers/char/console.c
drivers/char/cyclades.c
drivers/char/lp.c
drivers/char/mem.c
drivers/char/serial.c
drivers/char/tpqic02.c
drivers/char/tty_ioctl.c
drivers/net/3c501.c
drivers/net/3c509.c
drivers/net/8390.c
drivers/net/MODULES [deleted file]
drivers/net/Makefile
drivers/net/apricot.c
drivers/net/de600.c
drivers/net/de620.c
drivers/net/depca.c
drivers/net/dummy.c
drivers/net/eexpress.c
drivers/net/ewrk3.c
drivers/net/net_init.c
drivers/net/plip.c
drivers/net/slhc.c
drivers/net/slip.c
drivers/net/tulip.c
drivers/scsi/53c7,8xx.c
drivers/scsi/Makefile
drivers/scsi/aha1542.c
drivers/scsi/buslogic.c
drivers/scsi/hosts.c
drivers/scsi/qlogic.c
drivers/scsi/scsi_ioctl.c
drivers/scsi/sd.c
drivers/scsi/sd_ioctl.c
drivers/scsi/sg.c
drivers/scsi/sr_ioctl.c
drivers/scsi/st.c
drivers/sound/soundcard.c
fs/Makefile
fs/block_dev.c
fs/buffer.c
fs/ext2/inode.c
fs/ext2/ioctl.c
fs/fifo.c
fs/ioctl.c
fs/isofs/dir.c
fs/isofs/file.c
fs/isofs/inode.c
fs/isofs/namei.c
fs/isofs/rock.c
fs/isofs/symlink.c
fs/isofs/util.c
fs/minix/bitmap.c
fs/minix/dir.c
fs/minix/file.c
fs/minix/fsync.c
fs/minix/namei.c
fs/minix/symlink.c
fs/minix/truncate.c
fs/msdos/buffer.c
fs/msdos/dir.c
fs/msdos/fat.c
fs/msdos/file.c
fs/msdos/inode.c
fs/msdos/misc.c
fs/msdos/mmap.c
fs/msdos/namei.c
fs/nfs/dir.c
fs/nfs/file.c
fs/nfs/inode.c
fs/nfs/mmap.c
fs/nfs/proc.c
fs/nfs/sock.c
fs/nfs/symlink.c
fs/open.c
fs/pipe.c
fs/proc/array.c
fs/proc/inode.c
fs/proc/link.c
fs/proc/net.c
fs/read_write.c
fs/select.c
fs/stat.c
fs/sysv/balloc.c
fs/sysv/dir.c
fs/sysv/file.c
fs/sysv/fsync.c
fs/sysv/ialloc.c
fs/sysv/inode.c
fs/sysv/namei.c
fs/sysv/symlink.c
fs/sysv/truncate.c
fs/umsdos/check.c
fs/umsdos/dir.c
fs/umsdos/emd.c
fs/umsdos/file.c
fs/umsdos/inode.c
fs/umsdos/ioctl.c
fs/umsdos/mangle.c
fs/umsdos/namei.c
fs/umsdos/rdir.c
fs/umsdos/symlink.c
fs/xiafs/bitmap.c
fs/xiafs/dir.c
fs/xiafs/file.c
fs/xiafs/fsync.c
fs/xiafs/inode.c
fs/xiafs/namei.c
fs/xiafs/symlink.c
fs/xiafs/truncate.c
include/asm-alpha/page.h
include/asm-alpha/processor.h
include/asm-i386/page.h
include/asm-i386/processor.h
include/asm-mips/processor.h
include/asm-sparc/cprefix.h [new file with mode: 0644]
include/asm-sparc/idprom.h [new file with mode: 0644]
include/asm-sparc/page.h
include/asm-sparc/param.h [new file with mode: 0644]
include/asm-sparc/processor.h
include/asm-sparc/signal.h [new file with mode: 0644]
include/asm-sparc/string.h
include/asm-sparc/system.h
include/asm-sparc/types.h
include/asm-sparc/vac-ops.h
include/linux/malloc.h
include/linux/mm.h
include/linux/mman.h
include/linux/module.h
include/linux/pci.h
include/linux/sched.h
include/linux/symtab_begin.h [new file with mode: 0644]
include/linux/symtab_end.h [new file with mode: 0644]
init/main.c
ipc/shm.c
ipc/util.c
kernel/Makefile
kernel/exec_domain.c
kernel/itimer.c
kernel/ksyms.c
kernel/module.c
kernel/printk.c
kernel/sched.c
kernel/signal.c
kernel/softirq.c
kernel/time.c
mm/memory.c
mm/mmap.c
mm/mprotect.c
mm/vmalloc.c
modules/NET_MODULES [deleted file]
net/inet/arp.c
net/inet/ip.c
net/inet/ip.h
net/inet/packet.c
net/inet/rarp.c
net/inet/route.c
net/socket.c
versions.mk [new file with mode: 0644]

diff --git a/CREDITS b/CREDITS
index f392830ac292fd9a14b62e7dc5ad863d522f7357..eacc689a82bc064e86a47cb39df9d280224ee7ed 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -21,7 +21,7 @@ D: Linux-AFS Port, random kernel hacker,
 D: VFS fixes (new notify_change in particular)
 D: Moving all VFS access checks into the file systems
 S: MIT Room E15-341
-S: 20 Ames St.
+S: 20 Ames Street
 S: Cambridge, Massachusetts  02139
 S: USA
 
@@ -88,7 +88,7 @@ N: Randolph Bentson
 E: bentson@grieg.seaslug.org
 D: author of driver for Cyclades Cyclom-Y async mux
 S: 2500 Gilman Dr W, #404
-S: Seattle, WA 98119-2102
+S: Seattle, Washington 98119-2102
 S: USA
 
 N: Stephen R. van den Berg (AKA BuGless)
@@ -371,7 +371,7 @@ S: USA
 N: Rob W. W. Hooft
 E: hooft@EMBL-Heidelberg.DE
 D: Shared libs for graphics-tools and for the f2c compiler
-D: Some kernel programming on the floppy and sounddrivers in early days
+D: Some kernel programming on the floppy and sound drivers in early days
 D: Some other hacks to get different kinds of programs to work for linux
 S: Panoramastrasse 18
 S: D-69126 Heidelberg
@@ -530,7 +530,6 @@ S: Australia
 
 N: John A. Martin
 E: jam@acm.org
-E: j.a.martin@ieee.org
 D: FSSTND contributor
 D: Credit file compilator
 
@@ -663,6 +662,10 @@ S: Subiaco, 6008
 S: Perth, Western Australia
 S: Australia
 
+N: Greg Page
+E: greg@caldera.com
+D: IPX development and support
+
 N: Kai Petzke
 E: wpp@marie.physik.tu-berlin.de
 D: Driver for Laser Magnetic Storage CD-ROM
index bfdb0345adcd3ed06de33f459afad3a8a452e3bd..774fe7aebc28acf28bf0a61789b55713596cab49 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 1
 PATCHLEVEL = 1
-SUBLEVEL = 84
+SUBLEVEL = 85
 
 ARCH = i386
 
@@ -194,9 +194,32 @@ drivers: dummy
 net: dummy
        $(MAKE) linuxsubdirs SUBDIRS=net
 
+ifdef CONFIG_MODVERSIONS
+MODV = -DCONFIG_MODVERSIONS
+endif
+
 modules: dummy
-       @set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i CFLAGS="$(CFLAGS) -DMODULE" modules; done
+       @set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i CFLAGS="$(CFLAGS) -DMODULE $(MODV)" modules; done
        
+modules_install:
+       @( \
+       MODLIB=/lib/modules/$(VERSION).$(PATCHLEVEL).$(SUBLEVEL); \
+       cd modules; \
+       MODULES=""; \
+       inst_mod() { These="`cat $$1`"; MODULES="$$MODULES $$These"; \
+               mkdir -p $$MODLIB/$$2; cp -p $$These $$MODLIB/$$2; \
+               echo Installing modules under $$MODLIB/$$2; \
+       }; \
+       \
+       if [ -f NET_MODULES  ]; then inst_mod NET_MODULES  net;  fi; \
+       if [ -f SCSI_MODULES ]; then inst_mod SCSI_MODULES scsi; fi; \
+       if [ -f FS_MODULES   ]; then inst_mod FS_MODULES   fs;   fi; \
+       \
+       ls *.o > .allmods; \
+       echo $$MODULES | tr ' ' '\n' | sort | comm -23 .allmods - > .misc; \
+       inst_mod .misc misc; \
+       rm -f .misc .allmods; \
+       )
 
 clean: archclean
        rm -f kernel/ksyms.lst
@@ -204,6 +227,11 @@ clean:     archclean
        rm -f core `find . -name 'core' -print`
        rm -f vmlinux System.map
        rm -f .tmp* drivers/sound/configure
+       rm -fr modules/*
+ifdef CONFIG_MODVERSIONS
+       rm -f $(TOPDIR)/include/linux/modversions.h
+       rm -f $(TOPDIR)/include/linux/modules/*
+endif
 
 mrproper: clean
        rm -f include/linux/autoconf.h include/linux/version.h
@@ -224,6 +252,12 @@ depend dep: archdep
        set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i dep; done
        rm -f include/linux/version.h
        mv .tmpdepend .depend
+ifdef CONFIG_MODVERSIONS
+       @echo updating $(TOPDIR)/include/linux/modversions.h
+       @(cd $(TOPDIR)/include/linux/modules; for f in *.ver;\
+       do echo "#include <linux/modules/$${f}>"; done) \
+       > $(TOPDIR)/include/linux/modversions.h
+endif
 
 ifdef CONFIGURATION
 ..$(CONFIGURATION):
diff --git a/README.modules b/README.modules
new file mode 100644 (file)
index 0000000..da73448
--- /dev/null
@@ -0,0 +1,96 @@
+This file describes the strategy for dynamically loadable modules
+in the Linux kernel. This is not a technical description on
+the internals of module, but mostly a sample of how to compile
+and use modules.
+
+In this kernel you also have a possibility to create modules that are
+less dependent on the kernel version.  This option can be selected
+during "make config", by enabling CONFIG_MODVERSIONS.
+Note: If you enable CONFIG_MODVERSIONS, you will need some utilities
+      from the latest module support package: "modules-1.1.8*.tar.gz"!
+
+Anyway, your first step is to compile the kernel, as explained in the
+file README.  It generally goes like:
+
+       make config
+       make dep
+       make clean
+       make zImage or make zlilo
+
+In "make config", you select what you want to include in the kernel.
+You will generally select the miminal set that is needed to boot:
+
+       The filesystem of your root partition
+       A scsi driver, but see below for a list of SCSI modules!
+       Normal hard drive support
+       Net support (CONFIG_NET)
+       TCP/IP support (CONFIG_INET), but no drivers!
+
+       plus those things that you just can't live without...
+
+What has been left out is generally loadable as a modules.
+The set of modules is rapidly increasing, but so far these are known:
+
+       Most filesystems: minix, xiafs, msdos, umsdos, sysv, isofs
+
+       Some SCSI drivers: aha1542, in2000
+
+       Some ethernet drivers:
+               plip, slip, dummy,
+               de600, de620
+               3c501, 3c509
+               eexpress, depca,
+               ewrk3, apricot
+
+       Some misc modules:
+               lp: line printer
+               binfmt_elf: elf loader
+
+When you have made the kernel, you create the modules by doing:
+
+       make modules
+
+This will compile all modules and update the modules directory.
+In this directory you will then find a bunch of symbolic links,
+pointing to the various object files in the kernel tree.
+
+As soon as you have rebooted the newly made kernel, you can install
+and remove modules at will with the utilities: "insmod" and "rmmod".
+
+
+Now, after you have made all modules, you can also do:
+
+       make modules_install
+
+This will copy all newly made modules into subdirectories under
+"/lib/modules/kernel_release/", where "kernel_release" is something
+like 1.1.83, or whatever the current kernel version is...
+
+
+Nifty features:
+
+If you have installed the utilities from "modules-1.1.8*.tar.gz",
+you will have access to two new utilities: "modprobe" and "depmod"
+
+Using the modprobe utility, you can load any module like this:
+
+       /sbin/modprobe module
+
+without paying much attention to which kernel you are running.
+To use modprobe successfully, you generally place the following
+command in your /etc/rc.d/rc.S script.
+
+       /sbin/depmod -a
+
+This computes the dependencies between the different modules.
+Then if you do, for example
+
+       /sbin/modprobe umsdos
+
+you will automatically load _both_ the msdos and umsdos modules,
+since umsdos runs piggyback on msdos.
+
+
+Written by:
+       Jacques Gelinas <jacques@solucorp.qc.ca>
+       Bjorn Ekwall <bj0rn@blox.se>
index 4b5f5e58a10c91d8945049f4099a00b8c5faa8c6..c1b49108f40272dd5d35645f0063878a548bfcbb 100644 (file)
@@ -161,17 +161,37 @@ static inline long load(long dev, unsigned long addr, unsigned long count)
        return dispatch(CCB_READ, dev, count, addr, BOOT_SIZE/512 + 1);
 }
 
+/*
+ * Start the kernel:
+ * - switch to the proper PCB structure
+ * - switch to the proper ptbr
+ * - switch to the new kernel stack
+ */
 static void runkernel(void)
 {
        struct pcb_struct * init_pcb = (struct pcb_struct *) INIT_PCB;
+       unsigned long oldptbr, *oldL1;
+       unsigned long newptbr, *newL1;
+
+       oldptbr = pcb_va->ptbr;
+       oldL1 = (unsigned long *) (PAGE_OFFSET + (oldptbr << PAGE_SHIFT));
+
+       newptbr = (SWAPPER_PGD - PAGE_OFFSET) >> PAGE_SHIFT;
+       newL1 = (unsigned long *) SWAPPER_PGD;
+
+       memcpy(newL1, oldL1, PAGE_SIZE);
+       newL1[1023] = (newptbr << 32) | pgprot_val(PAGE_KERNEL);
 
        *init_pcb = *pcb_va;
        init_pcb->ksp = PAGE_SIZE + INIT_STACK;
+       init_pcb->ptbr = newptbr;
        
        __asm__ __volatile__(
                "bis %0,%0,$26\n\t"
                "bis %1,%1,$16\n\t"
                ".long %2\n\t"
+               "lda $16,-2($31)\n\t"
+               ".long 51\n\t"
                "ret ($26)"
                : /* no outputs: it doesn't even return */
                : "r" (START_ADDR),
index de505ee55e1c05240703098727ef4a99a09d06df..2fc6e04a14ea9aed5a514ac17fb740d30c3c8c10 100644 (file)
@@ -103,6 +103,40 @@ int get_irq_list(char *buf)
        return len;
 }
 
+static inline void ack_irq(int irq)
+{
+       /* ACK the interrupt making it the lowest priority */
+       /*  First the slave .. */
+       if (irq > 7) {
+               outb(0xE0 | (irq - 8), 0xa0);
+               irq = 2;
+       }
+       /* .. then the master */
+       outb(0xE0 | irq, 0x20);
+}
+
+static inline void mask_irq(int irq)
+{
+       if (irq < 8) {
+               cache_21 |= 1 << irq;
+               outb(cache_21, 0x21);
+       } else {
+               cache_A1 |= 1 << (irq - 8);
+               outb(cache_A1, 0xA1);
+       }
+}
+
+static inline void unmask_irq(unsigned long irq)
+{
+       if (irq < 8) {
+               cache_21 &= ~(1 << irq);
+               outb(cache_21, 0x21);
+       } else {
+               cache_A1 &= ~(1 << (irq - 8));
+               outb(cache_A1, 0xA1);
+       }
+}
+
 int request_irq(unsigned int irq, void (*handler)(int, struct pt_regs *),
        unsigned long irqflags, const char * devname)
 {
@@ -122,7 +156,7 @@ int request_irq(unsigned int irq, void (*handler)(int, struct pt_regs *),
        action->flags = irqflags;
        action->mask = 0;
        action->name = devname;
-       if (irq < 8) {
+       if (irq < 8 && irq) {
                cache_21 &= ~(1<<irq);
                outb(cache_21,0x21);
        } else {
@@ -137,7 +171,25 @@ int request_irq(unsigned int irq, void (*handler)(int, struct pt_regs *),
 
 void free_irq(unsigned int irq)
 {
-       halt();
+       struct irqaction * action = irq + irq_action;
+       unsigned long flags;
+
+       if (irq > 15) {
+               printk("Trying to free IRQ%d\n", irq);
+               return;
+       }
+       if (!action->handler) {
+               printk("Trying to free free IRQ%d\n", irq);
+               return;
+       }
+       save_flags(flags);
+       cli();
+       mask_irq(irq);
+       action->handler = NULL;
+       action->flags = 0;
+       action->mask = 0;
+       action->name = NULL;
+       restore_flags(flags);
 }
 
 static void handle_nmi(struct pt_regs * regs)
@@ -229,6 +281,7 @@ static void local_device_interrupt(unsigned long vector, struct pt_regs * regs)
 static void device_interrupt(unsigned long vector, struct pt_regs * regs)
 {
        int irq, ack;
+       struct irqaction * action;
 
        if (vector == 0x660) {
                handle_nmi(regs);
@@ -246,19 +299,73 @@ static void device_interrupt(unsigned long vector, struct pt_regs * regs)
                irq = 7;
 #endif
        printk("%d%d", irq, ack);
-       if (!irq)
-               printk(".");
-       else
-               handle_irq(irq, regs);
+       kstat.interrupts[irq]++;
+       action = irq_action + irq;
+       /* quick interrupts get executed with no extra overhead */
+       if (action->flags & SA_INTERRUPT) {
+               action->handler(irq, regs);
+               ack_irq(ack);
+               return;
+       }
+       /*
+        * For normal interrupts, we mask it out, and then ACK it.
+        * This way another (more timing-critical) interrupt can
+        * come through while we're doing this one.
+        *
+        * Note! A irq without a handler gets masked and acked, but
+        * never unmasked. The autoirq stuff depends on this (it looks
+        * at the masks before and after doing the probing).
+        */
+       mask_irq(ack);
+       ack_irq(ack);
+       if (!action->handler)
+               return;
+       action->handler(irq, regs);
+       unmask_irq(ack);
+}
 
-       /* ACK the interrupt making it the lowest priority */
-       /*  First the slave .. */
-       if (ack > 7) {
-               outb(0xC0 | (ack - 8), 0xa0);
-               ack = 2;
+/*
+ * Start listening for interrupts..
+ */
+unsigned int probe_irq_on(void)
+{
+       unsigned int i, irqs = 0, irqmask;
+       unsigned long delay;
+
+       for (i = 15; i > 0; i--) {
+               if (!irq_action[i].handler) {
+                       enable_irq(i);
+                       irqs |= (1 << i);
+               }
        }
-       /* .. then the master */
-       outb(0xC0 | ack, 0x20);
+
+       /* wait for spurious interrupts to mask themselves out again */
+       for (delay = jiffies + HZ/10; delay > jiffies; )
+               /* about 100 ms delay */;
+       
+       /* now filter out any obviously spurious interrupts */
+       irqmask = (((unsigned int)cache_A1)<<8) | (unsigned int) cache_21;
+       irqs &= ~irqmask;
+       return irqs;
+}
+
+/*
+ * Get the result of the IRQ probe.. A negative result means that
+ * we have several candidates (but we return the lowest-numbered
+ * one).
+ */
+int probe_irq_off(unsigned int irqs)
+{
+       unsigned int i, irqmask;
+       
+       irqmask = (((unsigned int)cache_A1)<<8) | (unsigned int)cache_21;
+       irqs &= irqmask;
+       if (!irqs)
+               return 0;
+       i = ffz(~irqs);
+       if (irqs != (1 << i))
+               i = -i;
+       return i;
 }
 
 static void machine_check(unsigned long vector, unsigned long la_ptr, struct pt_regs * regs)
index db6b9e56e82b88638f1a8cd9bedc301d3f3bba58..a977a62fc4d35acc6caca915804ee7f6e5d82cfc 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/types.h>
 #include <linux/ptrace.h>
 #include <linux/mman.h>
+#include <linux/mm.h>
 
 #include <asm/system.h>
 #include <asm/segment.h>
index 1ab81cbd3e86fdd054266a806c3272a8a79acc96..4d90c71a12b0b0efd56ff2e6cbc3b33da282bb66 100644 (file)
@@ -38,22 +38,22 @@ extern void show_net_buffers(void);
  * ZERO_PAGE is a special page that is used for zero-initialized
  * data and COW.
  */
-struct pte * __bad_pagetable(void)
+pte_t * __bad_pagetable(void)
 {
        memset((void *) EMPTY_PGT, 0, PAGE_SIZE);
-       return (struct pte *) EMPTY_PGT;
+       return (pte_t *) EMPTY_PGT;
 }
 
-unsigned long __bad_page(void)
+pte_t __bad_page(void)
 {
        memset((void *) EMPTY_PGE, 0, PAGE_SIZE);
-       return EMPTY_PGE;
+       return pte_mkdirty(mk_pte((unsigned long) EMPTY_PGE, PAGE_SHARED));
 }
 
 unsigned long __zero_page(void)
 {
        memset((void *) ZERO_PGE, 0, PAGE_SIZE);
-       return ZERO_PGE;
+       return (unsigned long) ZERO_PGE;
 }
 
 void show_mem(void)
index d52302184a538e648dae7f6c8f858685365c182d..fecd1a6b66f9182da0fb58a5d368f06729fb7bfd 100644 (file)
@@ -35,6 +35,9 @@ bool 'Kernel support for ELF binaries' CONFIG_BINFMT_ELF y
 bool 'Use -m486 flag for 486-specific optimizations' CONFIG_M486 y
 #fi
 
+comment 'Loadable module support'
+bool 'Set version information on all symbols for modules' CONFIG_MODVERSIONS n
+
 if [ "$CONFIG_NET" = "y" ]; then
 comment 'Networking options'
 bool 'TCP/IP networking' CONFIG_INET y
index e4dcb50975cba8e1be705c2e2941a9b93c7e0cd0..eb6cdad992960605b471e3666ea45dee21b97644 100644 (file)
@@ -132,6 +132,15 @@ static pci_resource_t pci_list = { 0, 0, NULL };
 static int pci_index = 0;
 static pci_resource_t pci_table[PCI_LIST_SIZE];
 
+static struct  pci_class_type pci_class[PCI_CLASS_NUM] = PCI_CLASS_TYPE;
+static struct  pci_vendor_type pci_vendor[PCI_VENDOR_NUM] = PCI_VENDOR_TYPE;
+static struct  pci_device_type pci_device[PCI_DEVICE_NUM] = PCI_DEVICE_TYPE;
+
+#ifdef CONFIG_PCI_OPTIMIZE
+static struct bridge_mapping_type bridge_mapping[5*BRIDGE_MAPPING_NUM] = BRIDGE_MAPPING_TYPE;
+static struct optimisation_type optimisation[OPTIMISATION_NUM] = OPTIMISATION_TYPE;
+#endif
+
 static unsigned long bios32_service(unsigned long service)
 {
        unsigned char return_code;      /* %al */
@@ -487,13 +496,12 @@ int revision_decode(unsigned char bus,unsigned char dev_fn)
 
 int class_decode(unsigned char bus,unsigned char dev_fn)
 {
-       struct pci_class_type   pci_class[PCI_CLASS_NUM] = PCI_CLASS_TYPE;
        int                     i;
        unsigned long           class;
                pcibios_read_config_dword(
                        bus, dev_fn, (unsigned char) PCI_CLASS_REVISION, &class);
                class=class >> 16;
-               for (i=0;i<PCI_CLASS_NUM;i++)
+               for (i=0;i<PCI_CLASS_NUM-1;i++)
                        if (class==pci_class[i].class_id) break;
                return i;
 }
@@ -501,8 +509,6 @@ int class_decode(unsigned char bus,unsigned char dev_fn)
 
 int device_decode(unsigned char bus,unsigned char dev_fn,unsigned short vendor_num)
 {
-       struct pci_device_type  pci_device[PCI_DEVICE_NUM] = PCI_DEVICE_TYPE;
-       struct pci_vendor_type  pci_vendor[PCI_VENDOR_NUM] = PCI_VENDOR_TYPE;
        int                     i;
        unsigned short          device;
 
@@ -517,7 +523,6 @@ int device_decode(unsigned char bus,unsigned char dev_fn,unsigned short vendor_n
 
 int vendor_decode(unsigned char bus,unsigned char dev_fn)
 {
-       struct pci_vendor_type  pci_vendor[PCI_VENDOR_NUM] = PCI_VENDOR_TYPE;
        int                     i;
        unsigned short          vendor;
 
@@ -530,18 +535,10 @@ int vendor_decode(unsigned char bus,unsigned char dev_fn)
 
 #ifdef CONFIG_PCI_OPTIMIZE
 
-unsigned char bridge_decode(int device)
-{
-       struct pci_device_type  pci_device[PCI_DEVICE_NUM] = PCI_DEVICE_TYPE;
-       return (pci_device[device].bridge_id);
-}
-
 /* Turn on/off PCI bridge optimisation. This should allow benchmarking. */
 
 void burst_bridge(unsigned char bus,unsigned char dev_fn,unsigned char pos, int turn_on)
 {
-       struct bridge_mapping_type bridge_mapping[5*BRIDGE_MAPPING_NUM] = BRIDGE_MAPPING_TYPE;
-       struct optimisation_type optimisation[OPTIMISATION_NUM] = OPTIMISATION_TYPE;
        int i;
        unsigned char val;
 
@@ -583,7 +580,7 @@ void burst_bridge(unsigned char bus,unsigned char dev_fn,unsigned char pos, int
 
 #endif
 
-/* In future version in case we detect a PCI to PCi bridge, we will go
+/* In future version in case we detect a PCI to PCI bridge, we will go
 for a recursive device search*/
 
 void probe_devices(unsigned char bus)
@@ -652,7 +649,7 @@ void add_pci_resource(unsigned char bus, unsigned char dev_fn)
         */
 #ifdef CONFIG_PCI_OPTIMIZE
 
-       bridge_id=bridge_decode(device_id);
+       bridge_id=pci_device[device_id].bridge_id;
        if (bridge_id != 0xff)
        {
                burst_bridge(bus,dev_fn,bridge_id,1); /* Burst bridge */
@@ -700,9 +697,6 @@ int get_pci_list(char* buf)
 {
        int pr, length;
        pci_resource_t* temp = pci_list.next;
-       struct  pci_class_type  pci_class[PCI_CLASS_NUM] = PCI_CLASS_TYPE;
-       struct  pci_vendor_type pci_vendor[PCI_VENDOR_NUM] = PCI_VENDOR_TYPE;
-       struct  pci_device_type pci_device[PCI_DEVICE_NUM] = PCI_DEVICE_TYPE;
 
        pr = sprintf(buf, "PCI devices found :\n"); 
        for (length = pr ; (temp) && (length<4000); temp = temp->next)
index 2351d7d25461dbd5d55b11d1c8ef61aa1a0d7ec2..f3adcb021cad674d328dd92398c8c3e77919d48c 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/string.h>
+#include <linux/mm.h>
 #include <asm/segment.h>
 #include <asm/system.h>
 #include <linux/ldt.h>
index be14a8f71d86d11c5dcd4a925e2e15c37c07a537..95ebdbddb99c582a2324fc81b8013a0b80312d7f 100644 (file)
@@ -5,6 +5,7 @@
  */
 
 #include <linux/sched.h>
+#include <linux/mm.h>
 #include <linux/kernel.h>
 #include <linux/signal.h>
 #include <linux/errno.h>
index 387911cdf4e48b30a0ab77017002b2e27d3953c8..5e97595b37b18202640d01e754e3b978b6ef6efc 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/ptrace.h>
 #include <linux/config.h>
 #include <linux/timer.h>
+#include <linux/mm.h>
 
 #include <asm/system.h>
 #include <asm/segment.h>
index 2e4bfb830ebe707d77c53ee31d4733963e00df46..94ac61b3f7af6b37c5f4a9cfe446048c62c36918 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/signal.h>
 #include <linux/string.h>
 #include <linux/ptrace.h>
+#include <linux/mm.h>
 
 #include <asm/segment.h>
 #include <asm/io.h>
index e09e08b15b6a2aa72f5a0e1933834a16881d8501..d2c3fa7160b9486c1523e92ad75134bf8b095936 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <linux/sched.h>
 #include <linux/kernel.h>
+#include <linux/mm.h>
 
 /* This sets the pointer FPU_info to point to the argument part
    of the stack frame of math_emulate() */
index c74bce6f7b324fd829ddda6cc39c51f28188d01f..dbc1716e8346f532bc23df5113b9d92fcfd0b5b6 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/types.h>
 #include <linux/ptrace.h>
 #include <linux/mman.h>
+#include <linux/mm.h>
 
 #include <asm/system.h>
 #include <asm/segment.h>
index 5280f69d7947c6151ef41a36cf0cc21a74a4e6d4..58f3fa1d2a9ff498d932d3b0beccef4fe9dedfd3 100644 (file)
@@ -5,6 +5,7 @@
  */
 
 #include <linux/sched.h>
+#include <linux/mm.h>
 #include <linux/kernel.h>
 #include <linux/signal.h>
 #include <linux/errno.h>
index e0a368a206664f3ef8358f1926c1f25d30ee550b..d782f837e07d6c8ab5421cee0a1c812c1da37cec 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/types.h>
 #include <linux/ptrace.h>
 #include <linux/mman.h>
+#include <linux/mm.h>
 
 #include <asm/system.h>
 #include <asm/segment.h>
index 11a763f190e1add71e15fc21f031fbe1459415bf..92020acd81c44df29871755e1886885d3dc7db8f 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/types.h>
 #include <linux/ptrace.h>
 #include <linux/mman.h>
+#include <linux/mm.h>
 
 #include <asm/system.h>
 #include <asm/segment.h>
index 9a840fcb4e50809e9b887614bd5f77524e0e5344..88bcd6578b491c31226a191b61f7d3ba2e8ba9f2 100644 (file)
@@ -7,6 +7,11 @@
 # Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
 #
 
+
+# If the solaris /bin/sh wasn't so broken, I wouldn't need the following
+# line...
+SHELL  =/bin/bash
+
 #
 # How to link, we send the linker the address at which the text section
 # is to start. The prom loads us at 0x0-kernel_size. There is also an
@@ -21,7 +26,7 @@ HEAD := arch/sparc/kernel/head.o
 
 SUBDIRS := $(SUBDIRS) arch/sparc/kernel arch/sparc/lib arch/sparc/mm
 ARCHIVES := arch/sparc/kernel/kernel.o arch/sparc/mm/mm.o $(ARCHIVES)
-LIBS := arch/sparc/lib/lib.a $(LIBS)
+LIBS := $(TOPDIR)/lib/lib.a $(LIBS) $(TOPDIR)/arch/sparc/lib/lib.a
 
 archclean:
 
index 4c662327ef0424523c796ba23f332f207b8fb593..58f5837a8057bc09ba691b05daf0fd099769af0f 100644 (file)
@@ -155,10 +155,10 @@ fi
 fi
 fi
 
-comment 'CD-ROM drivers'
+comment 'CD-ROM drivers (not for SCSI or IDE/ATAPI drives)'
 
 bool 'Sony CDU31A/CDU33A CDROM driver support' CONFIG_CDU31A n
-bool 'Mitsumi CDROM driver support' CONFIG_MCD n
+bool 'Mitsumi (not IDE/ATAPI) CDROM driver support' CONFIG_MCD n
 bool 'Matsushita/Panasonic CDROM driver support' CONFIG_SBPCD n
 if [ "$CONFIG_SBPCD" = "y" ]; then
   bool 'Matsushita/Panasonic second CDROM controller support' CONFIG_SBPCD2 n
@@ -169,6 +169,7 @@ if [ "$CONFIG_SBPCD" = "y" ]; then
     fi
   fi
 fi
+bool 'Aztech/Orchid/Okano/Wearnes (non IDE) CDROM support' CONFIG_AZTCD n
 
 comment 'Filesystems'
 
index b8ef29dbabdfded0a466c8543a5a9acf00c44804..b5151d77edded5bece75ee7aa3dcfd044da47811 100644 (file)
 .c.o:
        $(CC) $(CFLAGS) -c $<
 .S.s:
-       $(CPP) -D__ASSEMBLY__ -traditional $< -o $*.s
+       $(CPP) -D__ASSEMBLY__ -ansi $< -o $*.s
 .S.o:
-       $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
+       $(CC) -D__ASSEMBLY__ -ansi -c $< -o $*.o
 
-OBJS  = entry.o traps.o irq.o process.o promops.o signal.o ioport.o
+OBJS  = entry.o traps.o irq.o process.o promops.o signal.o ioport.o setup.o \
+       idprom.o probe.o
 
 all: kernel.o head.o
 
 head.o: head.s
 
 head.s: head.S $(TOPDIR)/include/asm-sparc/head.h
-       $(CPP) -D__ASSEMBLY__ -traditional -o $*.s $<
+       $(CPP) -D__ASSEMBLY__ -ansi -o $*.s $<
 
 kernel.o: $(OBJS)
        $(LD) -r -o kernel.o $(OBJS)
index 8a0f8cdf590339090fb251c83939cc0419bb5783..add72de3581e54755e46ef7c0543f19b4d551a14 100644 (file)
@@ -8,6 +8,7 @@
  * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
  */
 
+#include <asm/cprefix.h>
 #include <asm/head.h>
 #include <asm/asi.h>
 
@@ -40,8 +41,8 @@
        or      %g0, %g5, %l5;    /* we need the globals to do our work */ \
        or      %g0, %g6, %l6;    /* and %l0 to %l4 are loaded with important */ \
        or      %g0, %g7, %l7;    /* information like the psr and pc's to return to */ \
-       sethi   %hi(_current), %g6; \
-       ld      [%g6 + %lo(_current)], %g6; \
+       sethi   %hi( C_LABEL(current) ), %g6; \
+       ld      [%g6 + %lo( C_LABEL(current) )], %g6; \
        ld      [%g6 + THREAD_UWINDOWS], %g7; /* how many user wins are active? */ \
        subcc   %g7, 0x0, %g0
        bne     2f;                            /* If there are any, branch. */ \
        TRAP_WIN_CLEAN \
        b       3f; \
        sub     %fp, 0xb0, %sp; \
-1:     sethi   %hi(_current), %l6; \
-       ld      [%l6 + %lo(_current)], %l6; \
+1:     sethi   %hi( C_LABEL(current) ), %l6; \
+       ld      [%l6 + %lo( C_LABEL(current) )], %l6; \
        ld      [%l6 + THREAD_WIM], %l5; \
        and     %l0, 0x1f, %l4; \
        cmp     %l5, %l3; \
        ble,a   4f; \
-       sethi   %hi(_nwindowsm1), %l4; \
+       sethi   %hi( C_LABEL(nwindowsm1) ), %l4; \
        sub     %l5, %l3, %l3; \
        b       5f; \
        sub     %l3, 0x1, %l5; \
-4:     ld      [%l4 + %lo(_nwindowsm1)], %l4; \
+4:     ld      [%l4 + %lo( C_LABEL(nwindowsm1) )], %l4; \
        sub     %l4, %l3, %l4; \
        add     %l5, %l4, %l5; \
 5:     st      %l5, [%l6 + THREAD_UWINDOWS]; \
        bz,a    2f; \
        sethi   %hi(TASK_SIZE-176), %l5; \
        TRAP_WIN_CLEAN; \
-       sethi   %hi(_current), %l6; \
-       ld      [%l6 + %lo(_current)], %l6; \
+       sethi   %hi( C_LABEL(current) ), %l6; \
+       ld      [%l6 + %lo( C_LABEL(current) )], %l6; \
        sethi   %hi(TASK_SIZE-176), %l5; \
 2:     or      %l5, %lo(TASK_SIZE-176), %l5; \
        add     %l6, %l5, %sp; \
        bz      1f; \
        andcc   %l4, %l5, %g0; \
        bz,a    0f; \
-       sethi   %hi(_eintstack), %l7; \
+       sethi   %hi( C_LABEL(eintstack) ), %l7; \
        TRAP_WIN_CLEAN \
-       sethi   %hi(_eintstack), %l7; \
+       sethi   %hi( C_LABEL(eintstack) ), %l7; \
 0:     cmp     %fp, %l7; \
        bge,a   3f; \
        sub     %l7, 0xb0, %sp; \
        b       3f; \
        sub     %fp, 0xb0, %sp; \
-1:     sethi   %hi(_current), %l6; \
-       ld      [%l6 + %lo(_current)], %l6; \
+1:     sethi   %hi( C_LABEL(current) ), %l6; \
+       ld      [%l6 + %lo( C_LABEL(current) )], %l6; \
        ld      [%l6 + PCB_WIM], %l5; \
        and     %l0, 0x1f, %l7; \
        cmp     %l5, %l7; \
        ble,a   4f; \
-       sethi   %hi(_nwindowsm1), %l4; \
+       sethi   %hi( C_LABEL(nwindowsm1) ), %l4; \
        sub     %l5, %l7, %l7; \
        b       5f; \
        sub     %l7, 0x1, %l5; \
-4:     ld      [%l4 + %lo(_nwindowsm1)], %l4; \
+4:     ld      [%l4 + %lo( C_LABEL(nwindowsm1) )], %l4; \
        sub     %l4, %l7, %l4; \
        add     %l5, %l4, %l5; \
 5:     st      %l5, [%l6 + THREAD_UWINDOWS]; \
        bz,a    2f; \
-       sethi   %hi(_eintstack), %l7; \
+       sethi   %hi( C_LABEL(eintstack) ), %l7; \
        TRAP_WIN_CLEAN; \
-       sethi   %hi(_eintstack), %l7; \
+       sethi   %hi( C_LABEL(eintstack) ), %l7; \
 2: \
        sub     %l7, 0xb0, %sp; \
 3: \
@@ -225,7 +226,7 @@ my_trap_handler:
 
                nop
                or %g0, %l3, %o0
-               call _do_hw_interrupt
+               call C_LABEL(do_hw_interrupt)
                or %g0, %g0, %o1
                wr %l0, 0x20, %psr  ! re-enable traps and reset the condition codes
                nop
@@ -256,8 +257,8 @@ fill_window_entry:
        rett    %l2
 
 fill_from_user:
-       sethi   %hi(_current), %l6
-       ld      [%l6 + %lo(_current)], %l6
+       sethi   %hi( C_LABEL(current) ), %l6
+       ld      [%l6 + %lo( C_LABEL(current) )], %l6
        ld      [%l6 + THREAD_WIM], %l5
        and     %l0, 0x1f, %l3
 
@@ -266,18 +267,18 @@ fill_from_user:
  */
        cmp     %l5, %l3
        ble,a   1f
-       sethi   %hi(_nwindowsm1), %l4
+       sethi   %hi( C_LABEL(nwindowsm1) ), %l4
        sub     %l5, %l3, %l3
        b       2f
        sub     %l3, 0x1, %l5
-1:     ld      [%l4 + %lo(_nwindowsm1)], %l4
+1:     ld      [%l4 + %lo( C_LABEL(nwindowsm1) )], %l4
        sub     %l4, %l3, %l4
        add     %l5, %l4, %l5
 2:     st      %l5, [%l6 + THREAD_UWINDOWS]
 
        TRAP_WIN_CLEAN             /* danger, danger... */
-       sethi   %hi(_current), %l6
-       ld      [%l6 + %lo(_current)], %l6
+       sethi   %hi( C_LABEL(current) ), %l6
+       ld      [%l6 + %lo( C_LABEL(current) )], %l6
        ld      [%l6 + THREAD_KSP], %sp
        and     %l0, 0x1f, %l3
        sethi   %hi(lnx_winmask), %l6
@@ -312,8 +313,8 @@ spill_window_entry:
        and     %l0, 0x1f, %l0
        sll     %l1, %l0, %l1
        wr      %l1, 0x0, %wim
-       sethi   %hi(_current), %l1
-       ld      [%l1 + %lo(_current)], %l1
+       sethi   %hi( C_LABEL(current) ), %l1
+       ld      [%l1 + %lo( C_LABEL(current) )], %l1
        st      %l0, [%l1 + THREAD_WIM]
        save    %g0, %g0, %g0           ! back to invalid register
        ldd     [%sp], %l0              ! load the window from stack
@@ -368,8 +369,8 @@ spill_from_user:
 spill_bad_stack:
        save    %g0, %g0, %g0                   ! save to where restore happened
        save    %g0, 0x1, %l4                   ! save is an add remember? to trap window
-       sethi   %hi(_current), %l6
-       ld      [%l6 + %lo(_current)], %l6
+       sethi   %hi( C_LABEL(current) ), %l6
+       ld      [%l6 + %lo( C_LABEL(current) )], %l6
        st      %l4, [%l6 + THREAD_UWINDOWS]    ! update current->tss values
        ld      [%l6 + THREAD_WIM], %l5
        sll     %l4, %l5, %l4
@@ -405,8 +406,8 @@ spill_bad_stack:
        ldd     [%sp + C_STACK + 0x40], %i4
        wr      %l0, 0, %psr                    ! disable traps again
        ldd     [%sp + C_STACK + 0x48], %i6
-       sethi   %hi(_current), %l6
-       ld      [%l6 + %lo(_current)], %l6
+       sethi   %hi( C_LABEL(current) ), %l6
+       ld      [%l6 + %lo( C_LABEL(current) )], %l6
        ld      [%l6 + THREAD_W_SAVED], %l7
        cmp     %l7, 0x0
        bl,a    1f
@@ -453,8 +454,8 @@ spill_stack_ok:
        rd      %psr, %l0
        sll     %l1, %l0, %l1
        wr      %l1, 0x0, %wim
-       sethi   %hi(_current), %l2
-       ld      [%l2 + %lo(_current)], %l2
+       sethi   %hi( C_LABEL(current) ), %l2
+       ld      [%l2 + %lo( C_LABEL(current) )], %l2
        and     %l0, 0x1f, %l0
        st      %l0, [%l2 + THREAD_WIM]
        save    %g0, %g0, %g0
@@ -511,146 +512,146 @@ lnx_winmask:    .byte   2, 4, 8, 16, 32, 64, 128,1  ! lnx_winmask[0..7]
 
        
                .align 4
-               .globl _sys_call_table
-_sys_call_table:
-       .long _sys_setup                /* 0 */
-       .long _sys_exit
-       .long _sys_fork
-       .long _sys_read
-       .long _sys_write
-       .long _sys_open                 /* 5 */
-       .long _sys_close
-       .long _sys_waitpid
-       .long _sys_creat
-       .long _sys_link
-       .long _sys_unlink               /* 10 */
-       .long _sys_execve
-       .long _sys_chdir
-       .long _sys_time
-       .long _sys_mknod
-       .long _sys_chmod                /* 15 */
-       .long _sys_chown
-       .long _sys_break
-       .long _sys_stat
-       .long _sys_lseek
-       .long _sys_getpid               /* 20 */
-       .long _sys_mount
-       .long _sys_umount
-       .long _sys_setuid
-       .long _sys_getuid
-       .long _sys_stime                /* 25 */
-       .long _sys_ni_syscall           /* this will be sys_ptrace() */
-       .long _sys_alarm
-       .long _sys_fstat
-       .long _sys_pause
-       .long _sys_utime                /* 30 */
-       .long _sys_stty
-       .long _sys_gtty
-       .long _sys_access
-       .long _sys_nice
-       .long _sys_ftime                /* 35 */
-       .long _sys_sync
-       .long _sys_kill
-       .long _sys_rename
-       .long _sys_mkdir
-       .long _sys_rmdir                /* 40 */
-       .long _sys_dup
-       .long _sys_pipe
-       .long _sys_times
-       .long _sys_prof
-       .long _sys_brk                  /* 45 */
-       .long _sys_setgid
-       .long _sys_getgid
-       .long _sys_signal
-       .long _sys_geteuid
-       .long _sys_getegid              /* 50 */
-       .long _sys_acct
-       .long _sys_phys
-       .long _sys_lock
-       .long _sys_ioctl
-       .long _sys_fcntl                /* 55 */
-       .long _sys_mpx
-       .long _sys_setpgid
-       .long _sys_ulimit
-       .long _sys_olduname
-       .long _sys_umask                /* 60 */
-       .long _sys_chroot
-       .long _sys_ustat
-       .long _sys_dup2
-       .long _sys_getppid
-       .long _sys_getpgrp              /* 65 */
-       .long _sys_setsid
-       .long _sys_sigaction
-       .long _sys_sgetmask
-       .long _sys_ssetmask
-       .long _sys_setreuid             /* 70 */
-       .long _sys_setregid
-       .long _sys_sigsuspend
-       .long _sys_sigpending
-       .long _sys_sethostname
-       .long _sys_setrlimit            /* 75 */
-       .long _sys_getrlimit
-       .long _sys_getrusage
-       .long _sys_gettimeofday
-       .long _sys_settimeofday
-       .long _sys_getgroups            /* 80 */
-       .long _sys_setgroups
-       .long _sys_select
-       .long _sys_symlink
-       .long _sys_lstat
-       .long _sys_readlink             /* 85 */
-       .long _sys_uselib
-       .long _sys_swapon
-       .long _sys_reboot
-       .long _sys_readdir
-       .long _sys_mmap                 /* 90 */
-       .long _sys_munmap
-       .long _sys_truncate
-       .long _sys_ftruncate
-       .long _sys_fchmod
-       .long _sys_fchown               /* 95 */
-       .long _sys_getpriority
-       .long _sys_setpriority
-       .long _sys_profil
-       .long _sys_statfs
-       .long _sys_fstatfs              /* 100 */
-       .long _sys_ni_syscall
-       .long _sys_socketcall
-       .long _sys_syslog
-       .long _sys_setitimer
-       .long _sys_getitimer            /* 105 */
-       .long _sys_newstat
-       .long _sys_newlstat
-       .long _sys_newfstat
-       .long _sys_uname
-       .long _sys_ni_syscall           /* 110 */
-       .long _sys_vhangup
-       .long _sys_idle
-       .long _sys_ni_syscall           /* was vm86, meaningless on Sparc */
-       .long _sys_wait4
-       .long _sys_swapoff              /* 115 */
-       .long _sys_sysinfo
-       .long _sys_ipc
-       .long _sys_fsync
-       .long _sys_sigreturn
-       .long _sys_ni_syscall           /* 120 */
-       .long _sys_setdomainname
-       .long _sys_newuname
-       .long _sys_ni_syscall
-       .long _sys_adjtimex
-       .long _sys_mprotect             /* 125 */
-       .long _sys_sigprocmask
-       .long _sys_create_module
-       .long _sys_init_module
-       .long _sys_delete_module
-       .long _sys_get_kernel_syms      /* 130 */
-       .long _sys_ni_syscall
-       .long _sys_getpgid
-       .long _sys_fchdir
-       .long _sys_bdflush
-       .long _sys_sysfs                /* 135 */
-       .long _sys_personality
+               .globl C_LABEL(sys_call_table)
+C_LABEL(sys_call_table):
+       .long C_LABEL(sys_setup)                /* 0 */
+       .long C_LABEL(sys_exit)
+       .long C_LABEL(sys_fork)
+       .long C_LABEL(sys_read)
+       .long C_LABEL(sys_write)
+       .long C_LABEL(sys_open)                 /* 5 */
+       .long C_LABEL(sys_close)
+       .long C_LABEL(sys_waitpid)
+       .long C_LABEL(sys_creat)
+       .long C_LABEL(sys_link)
+       .long C_LABEL(sys_unlink)               /* 10 */
+       .long C_LABEL(sys_execve)
+       .long C_LABEL(sys_chdir)
+       .long C_LABEL(sys_time)
+       .long C_LABEL(sys_mknod)
+       .long C_LABEL(sys_chmod)                /* 15 */
+       .long C_LABEL(sys_chown)
+       .long C_LABEL(sys_break)
+       .long C_LABEL(sys_stat)
+       .long C_LABEL(sys_lseek)
+       .long C_LABEL(sys_getpid)               /* 20 */
+       .long C_LABEL(sys_mount)
+       .long C_LABEL(sys_umount)
+       .long C_LABEL(sys_setuid)
+       .long C_LABEL(sys_getuid)
+       .long C_LABEL(sys_stime)                /* 25 */
+       .long C_LABEL(sys_ni_syscall)           /* this will be sys_ptrace() */
+       .long C_LABEL(sys_alarm)
+       .long C_LABEL(sys_fstat)
+       .long C_LABEL(sys_pause)
+       .long C_LABEL(sys_utime)                /* 30 */
+       .long C_LABEL(sys_stty)
+       .long C_LABEL(sys_gtty)
+       .long C_LABEL(sys_access)
+       .long C_LABEL(sys_nice)
+       .long C_LABEL(sys_ftime)                /* 35 */
+       .long C_LABEL(sys_sync)
+       .long C_LABEL(sys_kill)
+       .long C_LABEL(sys_rename)
+       .long C_LABEL(sys_mkdir)
+       .long C_LABEL(sys_rmdir)                /* 40 */
+       .long C_LABEL(sys_dup)
+       .long C_LABEL(sys_pipe)
+       .long C_LABEL(sys_times)
+       .long C_LABEL(sys_prof)
+       .long C_LABEL(sys_brk)                  /* 45 */
+       .long C_LABEL(sys_setgid)
+       .long C_LABEL(sys_getgid)
+       .long C_LABEL(sys_signal)
+       .long C_LABEL(sys_geteuid)
+       .long C_LABEL(sys_getegid)              /* 50 */
+       .long C_LABEL(sys_acct)
+       .long C_LABEL(sys_phys)
+       .long C_LABEL(sys_lock)
+       .long C_LABEL(sys_ioctl)
+       .long C_LABEL(sys_fcntl)                /* 55 */
+       .long C_LABEL(sys_mpx)
+       .long C_LABEL(sys_setpgid)
+       .long C_LABEL(sys_ulimit)
+       .long C_LABEL(sys_olduname)
+       .long C_LABEL(sys_umask)        /* 60 */
+       .long C_LABEL(sys_chroot)
+       .long C_LABEL(sys_ustat)
+       .long C_LABEL(sys_dup2)
+       .long C_LABEL(sys_getppid)
+       .long C_LABEL(sys_getpgrp)              /* 65 */
+       .long C_LABEL(sys_setsid)
+       .long C_LABEL(sys_sigaction)
+       .long C_LABEL(sys_sgetmask)
+       .long C_LABEL(sys_ssetmask)
+       .long C_LABEL(sys_setreuid)             /* 70 */
+       .long C_LABEL(sys_setregid)
+       .long C_LABEL(sys_sigsuspend)
+       .long C_LABEL(sys_sigpending)
+       .long C_LABEL(sys_sethostname)
+       .long C_LABEL(sys_setrlimit)            /* 75 */
+       .long C_LABEL(sys_getrlimit)
+       .long C_LABEL(sys_getrusage)
+       .long C_LABEL(sys_gettimeofday)
+       .long C_LABEL(sys_settimeofday)
+       .long C_LABEL(sys_getgroups)            /* 80 */
+       .long C_LABEL(sys_setgroups)
+       .long C_LABEL(sys_select)
+       .long C_LABEL(sys_symlink)
+       .long C_LABEL(sys_lstat)
+       .long C_LABEL(sys_readlink)             /* 85 */
+       .long C_LABEL(sys_uselib)
+       .long C_LABEL(sys_swapon)
+       .long C_LABEL(sys_reboot)
+       .long C_LABEL(sys_readdir)
+       .long C_LABEL(sys_mmap)                 /* 90 */
+       .long C_LABEL(sys_munmap)
+       .long C_LABEL(sys_truncate)
+       .long C_LABEL(sys_ftruncate)
+       .long C_LABEL(sys_fchmod)
+       .long C_LABEL(sys_fchown)               /* 95 */
+       .long C_LABEL(sys_getpriority)
+       .long C_LABEL(sys_setpriority)
+       .long C_LABEL(sys_profil)
+       .long C_LABEL(sys_statfs)
+       .long C_LABEL(sys_fstatfs)              /* 100 */
+       .long C_LABEL(sys_ni_syscall)
+       .long C_LABEL(sys_socketcall)
+       .long C_LABEL(sys_syslog)
+       .long C_LABEL(sys_setitimer)
+       .long C_LABEL(sys_getitimer)            /* 105 */
+       .long C_LABEL(sys_newstat)
+       .long C_LABEL(sys_newlstat)
+       .long C_LABEL(sys_newfstat)
+       .long C_LABEL(sys_uname)
+       .long C_LABEL(sys_ni_syscall)           /* 110 */
+       .long C_LABEL(sys_vhangup)
+       .long C_LABEL(sys_idle)
+       .long C_LABEL(sys_ni_syscall)           /* was vm86, meaningless on Sparc */
+       .long C_LABEL(sys_wait4)
+       .long C_LABEL(sys_swapoff)              /* 115 */
+       .long C_LABEL(sys_sysinfo)
+       .long C_LABEL(sys_ipc)
+       .long C_LABEL(sys_fsync)
+       .long C_LABEL(sys_sigreturn)
+       .long C_LABEL(sys_ni_syscall)           /* 120 */
+       .long C_LABEL(sys_setdomainname)
+       .long C_LABEL(sys_newuname)
+       .long C_LABEL(sys_ni_syscall)
+       .long C_LABEL(sys_adjtimex)
+       .long C_LABEL(sys_mprotect)             /* 125 */
+       .long C_LABEL(sys_sigprocmask)
+       .long C_LABEL(sys_create_module)
+       .long C_LABEL(sys_init_module)
+       .long C_LABEL(sys_delete_module)
+       .long C_LABEL(sys_get_kernel_syms)      /* 130 */
+       .long C_LABEL(sys_ni_syscall)
+       .long C_LABEL(sys_getpgid)
+       .long C_LABEL(sys_fchdir)
+       .long C_LABEL(sys_bdflush)
+       .long C_LABEL(sys_sysfs)        /* 135 */
+       .long C_LABEL(sys_personality)
        .long 0                         /* for afs_syscall */
-       .long _sys_setfsuid
-       .long _sys_setfsgid
-       .long _sys_llseek               /* 140 */
+       .long C_LABEL(sys_setfsuid)
+       .long C_LABEL(sys_setfsgid)
+       .long C_LABEL(sys_llseek)               /* 140 */
index aaff8716c99868e72012fc2bc4c4fa991ff69cb9..03e5dde73ccd31f4643b9f90b12f47dd6ff24b64 100644 (file)
@@ -40,6 +40,7 @@
    is, give me time.
 */
 
+#include <asm/cprefix.h>
 #include <asm/head.h>
 #include <asm/version.h>
 #include <asm/asi.h>
 
 /* First thing to go in the data segment is the interrupt stack. */
 
-        .globl  _intstack
-        .globl  _eintstack
-_intstack:
+        .globl  C_LABEL(intstack)
+        .globl  C_LABEL(eintstack)
+C_LABEL(intstack):
         .skip   4 * PAGE_SIZE                ! 16k = 128 128-byte stack frames
-_eintstack:
+C_LABEL(eintstack):
 
 
 
@@ -64,12 +65,12 @@ _eintstack:
    the cpu-type 
 */
 
-        .globl  _cputyp
+        .globl  C_LABEL(cputyp)
 
-_cputyp:
+C_LABEL(cputyp):
         .word   1
 
-_cputypval:
+C_LABEL(cputypval):
        .asciz "sun4c"
        .ascii "     "
 
@@ -82,17 +83,17 @@ _cputypval:
 /* Uh, actually Linus it is I who cannot spell. Too much murky
  * Sparc assembly will do this to ya.
  */
-_cputypvar:
+C_LABEL(cputypvar):
        .asciz "compatability"
 
-_cputypvallen = _cputypvar - _cputypval
+C_LABEL(cputypvallen) = C_LABEL(cputypvar) - C_LABEL(cputypval)
 
 /* This hold the prom-interface-version number for either v0 or v2. */
 
        .align 4
-       .globl  _prom_iface_vers
+       .globl  C_LABEL(prom_iface_vers)
 
-_prom_iface_vers:      .skip 4
+C_LABEL(prom_iface_vers):      .skip 4
 
 /* WARNING: evil messages follow */
 
@@ -165,7 +166,7 @@ boot_msg2:
        .align 4
 
 pstring1:
-       .asciz "Prom Magic Cookie: 0x%x  "
+       .asciz "Prom Magic Cookie: 0x%x  \n"
        .align 4
 
 pstring2:
@@ -182,18 +183,14 @@ pstring4:
        .align 4
 
 
-newline:
-       .asciz "\n"
-       .align 4
-
        .text
 
-        .globl  _msgbuf
+        .globl  C_LABEL(msgbuf)
 msgbufsize = PAGE_SIZE                       ! 1 page for msg buffer
-_msgbuf =  PAGE_SIZE
+C_LABEL(msgbuf) =  PAGE_SIZE
 
 
-IE_reg_addr = _msgbuf + msgbufsize      ! this page not used; points to IEreg
+IE_reg_addr = C_LABEL(msgbuf) + msgbufsize   ! this page not used; points to IEreg
 
        
 /* Ok, things start to get interesting. We get linked such that 'start'
@@ -227,9 +224,11 @@ IE_reg_addr = _msgbuf + msgbufsize      ! this page not used; points to IEreg
 */
 
        .globl  start
-       .globl  _trapbase
+       .globl  _start  /* warning, solaris hack */
+       .globl  C_LABEL(trapbase)
+_start:   /* danger danger */
 start:
-_trapbase:
+C_LABEL(trapbase):
        b gokernel; WRITE_PAUSE         ! we never get trap #0 it is special
 
        TRAP_ENTRY(0x1, my_trap_handler) /* Instruction Access Exception */
@@ -492,7 +491,7 @@ _trapbase:
        TRAP_ENTRY(0xfe, my_trap_handler)   /* Software Trap                 */
        TRAP_ENTRY(0xff, my_trap_handler)   /* Software Trap                 */ 
 
-_msgbufmapped:
+C_LABEL(msgbufmapped):
         .word   1
 
 
@@ -503,8 +502,8 @@ _msgbufmapped:
 */
 
 gokernel:      or      %g0, %o0, %g7
-               sethi   %hi(_prom_vector_p), %g1
-               st      %o0, [%g1 + %lo(_prom_vector_p)]   ! we will need it later
+               sethi   %hi( C_LABEL(prom_vector_p) ), %g1
+               st      %o0, [%g1 + %lo( C_LABEL(prom_vector_p) )]   ! we will need it later
                rd      %psr, %l2
                rd      %wim, %l3
                rd      %tbr, %l4
@@ -522,18 +521,18 @@ gokernel: or      %g0, %o0, %g7
  * I figure out and store nwindows later on.
  */
 
-nosmp:         sethi   %hi(_boot_psr), %l1
-               st      %l2, [%l1 + %lo(_boot_psr)]
-               sethi   %hi(_boot_wim), %l1
-               st      %l3, [%l1 + %lo(_boot_wim)]
-               sethi   %hi(_boot_tbr), %l1
-               st      %l4, [%l1 + %lo(_boot_tbr)]
-               sethi   %hi(_boot_smp_ptr), %l1
-               st      %l5, [%l1 + %lo(_boot_smp_ptr)]
+nosmp:         sethi   %hi( C_LABEL(boot_psr) ), %l1
+               st      %l2, [%l1 + %lo( C_LABEL(boot_psr) )]
+               sethi   %hi( C_LABEL(boot_wim) ), %l1
+               st      %l3, [%l1 + %lo( C_LABEL(boot_wim) )]
+               sethi   %hi( C_LABEL(boot_tbr) ), %l1
+               st      %l4, [%l1 + %lo( C_LABEL(boot_tbr) )]
+               sethi   %hi( C_LABEL(boot_smp_ptr) ), %l1
+               st      %l5, [%l1 + %lo( C_LABEL(boot_smp_ptr) )]
 
                or      %g0, %o0, %g7
-               sethi   %hi(_prom_vector_p), %g5
-               st      %o0, [%g5 + %lo(_prom_vector_p)]   ! we will need it later
+               sethi   %hi( C_LABEL(prom_vector_p) ), %g5
+               st      %o0, [%g5 + %lo( C_LABEL(prom_vector_p) )]   ! we will need it later
 
                ld      [%g7 + 0x4], %o3
                subcc   %o3, 0x2, %g0                   ! a v2 prom?
@@ -551,15 +550,15 @@ nosmp:            sethi   %hi(_boot_psr), %l1
                be      no_sun4_here
                nop
 
-               sethi   %hi(_prom_iface_vers), %g1
-               st      %g0, [%g1 + %lo(_prom_iface_vers)]
+               sethi   %hi( C_LABEL(prom_iface_vers) ), %g1
+               st      %g0, [%g1 + %lo( C_LABEL(prom_iface_vers) )]
                b       not_v2
                nop
 
 found_v2:
                or      %g0, 0x2, %o5
-               sethi   %hi(_prom_iface_vers), %g1
-               st      %o5, [%g1 + %lo(_prom_iface_vers)]
+               sethi   %hi( C_LABEL(prom_iface_vers) ), %g1
+               st      %o5, [%g1 + %lo( C_LABEL(prom_iface_vers) )]
 
 not_v2:
 
@@ -584,10 +583,10 @@ not_v2:
                call    %l0
                or      %g0, %g0, %o0           ! next_node(0) = first_node
 
-               sethi   %hi(_cputypvar), %o1    ! first node has cpu-arch
-               or      %o1, %lo(_cputypvar), %o1
-               sethi   %hi(_cputypval), %o2    ! information, the string
-               or      %o2, %lo(_cputypval), %o2
+               sethi   %hi( C_LABEL(cputypvar) ), %o1  ! first node has cpu-arch
+               or      %o1, %lo( C_LABEL(cputypvar) ), %o1
+               sethi   %hi( C_LABEL(cputypval) ), %o2  ! information, the string
+               or      %o2, %lo( C_LABEL(cputypval) ), %o2
                ld      [%l1], %l0              ! 'compatibility' tells
                ld      [%l0 + 0xc], %l0        ! that we want 'sun4x' where
                call    %l0                     ! x is one of '', 'c', 'm',
@@ -595,8 +594,8 @@ not_v2:
                                                ! to a buf where above string
                                                ! will get stored by the prom.
 
-               sethi   %hi(_cputypval), %o2    ! better safe than sorry
-               or      %o2, %lo(_cputypval), %o2
+               sethi   %hi( C_LABEL(cputypval) ), %o2  ! better safe than sorry
+               or      %o2, %lo( C_LABEL(cputypval) ), %o2
                ldub    [%o2 + 0x4], %o0
                subcc   %o0, 'c', %g0           ! we already know we are not
                be      is_sun4c                ! on a plain sun4 because of
@@ -661,14 +660,6 @@ is_sun4c:                                  ! OK, this is a sun4c, yippie
                call    %o1                     ! print boot message #1
                nop
 
-_newline:      sethi   %hi(newline), %o0
-               or      %o0, %lo(newline), %o0
-               sethi   %hi(prom_printf), %o1
-               ld      [%o1 + %lo(prom_printf)], %o1
-               ld      [%o1], %o1
-               call    %o1
-               nop
-
                sethi   %hi(pstring1), %o0
                or      %o0, %lo(pstring1), %o0
                sethi   %hi(prom_printf), %o2
@@ -678,18 +669,20 @@ _newline: sethi   %hi(newline), %o0
                ld      [%o1 + %lo(prom_magic)], %o1
                ld      [%o1], %o1
                call    %o2
+               nop
 
                sethi   %hi(pstring2), %o0
                or      %o0, %lo(pstring2), %o0
                sethi   %hi(prom_printf), %o2
                ld      [%o2 + %lo(prom_printf)], %o2
                ld      [%o2], %o2
-               sethi   %hi(_prom_iface_vers), %o1
-               ld      [%o1 + %lo(_prom_iface_vers)], %o1
+               sethi   %hi( C_LABEL(prom_iface_vers) ), %o1
+               ld      [%o1 + %lo( C_LABEL(prom_iface_vers) )], %o1
                ld      [%o1], %o1
                call    %o2
+               nop
 
-               b       halt_me
+               b       rest_of_boot
                nop
 
 no_sun4_here:
@@ -741,20 +734,20 @@ rest_of_boot:
                nop
 
                .align 4
-1:             sethi   %hi(_cputyp), %o0
-               st      %g4, [%o0 + %lo(_cputyp)]
+1:             sethi   %hi( C_LABEL(cputyp) ), %o0
+               st      %g4, [%o0 + %lo( C_LABEL(cputyp) )]
 
-               sethi   %hi(_pgshift), %o0
-               st      %g5, [%o0 + %lo(_pgshift)]
+               sethi   %hi( C_LABEL(pgshift) ), %o0
+               st      %g5, [%o0 + %lo( C_LABEL(pgshift) )]
 
                mov     1, %o0
                sll     %o0, %g5, %g5
-               sethi   %hi(_nbpg), %o0
-               st      %g5, [%o0 + %lo(_nbpg)]
+               sethi   %hi( C_LABEL(nbpg) ), %o0
+               st      %g5, [%o0 + %lo( C_LABEL(nbpg) )]
 
                sub     %g5, 1, %g5
-               sethi   %hi(_pgofset), %o0
-               st      %g5, [%o0 + %lo(_pgofset)]
+               sethi   %hi( C_LABEL(pgofset) ), %o0
+               st      %g5, [%o0 + %lo( C_LABEL(pgofset) )]
 
 
                rd      %psr, %g3
@@ -776,19 +769,24 @@ rest_of_boot:
  * write. ;-( like this (PSR_PS | PSR_S | PSR_PIL)...
  */
 
-               wr      %g0, (0xfc0), %psr
+               sethi   %hi(0x1fc0), %g2
+               or      %g2, %lo(0x1fc0), %g2
+               wr      %g2, 0x0, %psr
                WRITE_PAUSE
 
                wr      %g0, 0x2, %wim          ! window 1 invalid
                WRITE_PAUSE
                or      %g0, 0x1, %g1
-               sethi   %hi(_current + THREAD_WIM), %g2
-               st      %g1, [%g2 + %lo(_current + THREAD_WIM)]
+               sethi   %hi( C_LABEL(current) + THREAD_WIM), %g2
+               st      %g1, [%g2 + %lo( C_LABEL(current) + THREAD_WIM)]
 
 /* I want a kernel stack NOW! */
 
-               set     USRSTACK - C_STACK, %fp 
-               set     USRSTACK - C_STACK + 80, %sp
+               set     ( C_LABEL(init_user_stack) + 4096 - 96), %fp    
+               set     ( C_LABEL(init_user_stack) + 4096), %sp
+
+       /* now out stack is set up similarly to the way it is on the i386 */
+
                rd      %psr, %l0
                wr      %l0, PSR_ET, %psr
                WRITE_PAUSE
@@ -799,25 +797,25 @@ rest_of_boot:
  * don't know, do you?
  */
 
-               set     _edata, %o0
-               set     _end, %o1
+               set     C_LABEL(edata) , %o0
+               set     C_LABEL(end) , %o1
                sub     %o1, %o0, %g2
-               sethi   %hi(_kernel_bss_len), %g3
-               st      %g2, [%g3 + %lo(_kernel_bss_len)]
-               sethi   %hi(_trapbase), %g3
-               or      %g3, %lo(_trapbase), %g3
-               sethi   %hi(_etext), %g4
-               or      %g4, %lo(_etext), %g4                   
+               sethi   %hi( C_LABEL(kernel_bss_len) ), %g3
+               st      %g2, [%g3 + %lo( C_LABEL(kernel_bss_len) )]
+               sethi   %hi( C_LABEL(trapbase) ), %g3
+               or      %g3, %lo( C_LABEL(trapbase) ), %g3
+               sethi   %hi( C_LABEL(etext) ), %g4
+               or      %g4, %lo( C_LABEL(etext) ), %g4                 
                sub     %g4, %g3, %g2
-               sethi   %hi(_kernel_text_len), %g3
-               st      %g2, [%g3 + %lo(_kernel_text_len)]
-               sethi   %hi(_etext), %g4
-               or      %g4, %lo(_etext), %g4
-               sethi   %hi(_edata), %g3
-               or      %g3, %lo(_edata), %g3
+               sethi   %hi( C_LABEL(kernel_text_len) ), %g3
+               st      %g2, [%g3 + %lo( C_LABEL(kernel_text_len) )]
+               sethi   %hi( C_LABEL(etext) ), %g4
+               or      %g4, %lo( C_LABEL(etext) ), %g4
+               sethi   %hi( C_LABEL(edata) ), %g3
+               or      %g3, %lo( C_LABEL(edata) ), %g3
                sub     %g3, %g4, %g2
-               sethi   %hi(_kernel_data_len), %g3
-               st      %g2, [%g3 + %lo(_kernel_data_len)]
+               sethi   %hi( C_LABEL(kernel_data_len) ), %g3
+               st      %g2, [%g3 + %lo( C_LABEL(kernel_data_len) )]
                or      %g0, %g0, %g1
 
 1:     
@@ -845,53 +843,23 @@ rest_of_boot:
                subcc   %g1, 0x0, %g0                   ! bit set
                bne     1b
                add     %g3, 0x1, %g3
-               sethi   %hi(_nwindows), %g4
-               st      %g3, [%g4 + %lo(_nwindows)]     ! store final value
+               sethi   %hi( C_LABEL(nwindows) ), %g4
+               st      %g3, [%g4 + %lo( C_LABEL(nwindows) )]   ! store final value
                sub     %g3, 0x1, %g3
-               sethi   %hi(_nwindowsm1), %g4
-               st      %g3, [%g4 + %lo(_nwindowsm1)]
+               sethi   %hi( C_LABEL(nwindowsm1) ), %g4
+               st      %g3, [%g4 + %lo( C_LABEL(nwindowsm1) )]
 
 
 /* Here we go */
 
-/* start_kernel() wants the command line args at empty_zero_page, copy
- * the boot command line from the prom data struct here...
- */
-
-/* I still haven't gotten this right yet... hack hack hack */
-       
-#if 0
-               sethi   %hi(prom_v0bootline), %g6
-               ld      [%g6 + %lo(prom_v0bootline)], %g6
-               ld      [%g6], %g6
-               ld      [%g6], %g6
-               sethi   %hi(_empty_zero_page + 2048), %g2
-               ld      [%g2 + %lo(_empty_zero_page + 2048)], %g2
-               ld      [%g6], %g3      ! argv[0]               
-               or      %g0, 0x8, %g1   ! argv counter
-1:             ld      [%g3], %g4
-               st      %g4, [%g2]
-               add     %g3, 0x4, %g3
-               cmp     %g4, 0
-               bne,a   1b
-               add     %g2, 0x4, %g2
-
-               or      %g0, %lo(' '), %g4
-               st      %g4, [%g2]
-               sub     %g1, 0x1, %g1
-               add     %g3, 0x4, %g3
-               cmp     %g1, 0
-               bne     1b
-               add     %g2, 0x4, %g2
-#endif
-
 /* First we call init_prom() to set up romvec, then off to start_kernel() */
+/* XXX put this in arch_init() */
 
-               sethi   %hi(_prom_vector_p), %g5
-               call    _init_prom
-               ld      [%g5 + %lo(_prom_vector_p)], %o0   /* delay slot */
+               sethi   %hi( C_LABEL(prom_vector_p) ), %g5
+               call    C_LABEL(init_prom)
+               ld      [%g5 + %lo( C_LABEL(prom_vector_p) )], %o0   /* delay slot */
 
-               call    _start_kernel
+               call    C_LABEL(start_kernel)
                nop
        
                call    halt_me
@@ -921,9 +889,9 @@ halt_me:
  * gets initialized in c-code so all routines can use it.
  */
 
-                       .globl _prom_vector_p
+                       .globl C_LABEL(prom_vector_p)
 
-_prom_vector_p:                .skip 4
+C_LABEL(prom_vector_p):        .skip 4
 prom_magic:            .skip 4                 ! magic mushroom, beware...
 prom_rom_vers:                 .skip 4                 ! interface version (v0 or v2)
 prom_pluginvers:       .skip 4                 ! XXX help help help ???
@@ -958,58 +926,62 @@ prom_sync:                .skip 4                 ! hook in prom for sync func
  * code uses these to keep track of the register windows.
  */
 
-       .globl _nwindows
-       .globl _nwindowsm1
-_nwindows:     .skip 4
-_nwindowsm1:   .skip 4
+       .globl C_LABEL(nwindows)
+       .globl C_LABEL(nwindowsm1)
+C_LABEL(nwindows):     .skip 4
+C_LABEL(nwindowsm1):   .skip 4
 
        .align 4
 /* Boot time privileged register values, plus magic %o2 value */
 
-       .globl _boot_wim
-       .globl _boot_psr
-       .globl _boot_tbr
-       .globl _boot_smp_ptr
-_boot_wim:             .skip 4
-_boot_psr:             .skip 4
-_boot_tbr:             .skip 4
-_boot_smp_ptr:         .skip 4
+       .globl C_LABEL(boot_wim)
+       .globl C_LABEL(boot_psr)
+       .globl C_LABEL(boot_tbr)
+       .globl C_LABEL(boot_smp_ptr)
+C_LABEL(boot_wim):             .skip 4
+C_LABEL(boot_psr):             .skip 4
+C_LABEL(boot_tbr):             .skip 4
+C_LABEL(boot_smp_ptr):         .skip 4
 
 
        .align 4
 /* Miscellaneous pieces of information saved at kernel startup. */
-       .globl _kernel_text_len, _kernel_data_len, _kernel_bss_len
-_kernel_text_len:      .word 0
-_kernel_data_len:      .word 0
-_kernel_bss_len:       .word 0
+       .globl C_LABEL(kernel_text_len)
+       .globl C_LABEL(kernel_data_len)
+       .globl C_LABEL(kernel_bss_len)
+C_LABEL(kernel_text_len):      .word 0
+C_LABEL(kernel_data_len):      .word 0
+C_LABEL(kernel_bss_len):       .word 0
 
 /* These are for page alignment/offset information as they change from
    machine to machine.
 */
 
-        .globl  _pgshift, _nbpg, _pgofset
+        .globl  C_LABEL(pgshift)
+       .globl  C_LABEL(nbpg)
+       .globl  C_LABEL(pgofset)
 
        .align 4
-_pgshift:
+C_LABEL(pgshift):
         .word   1
-_nbpg:
+C_LABEL(nbpg):
         .word   1
-_pgofset:
+C_LABEL(pgofset):
         .word   1
 
 /* Just to get the kernel through the compiler for now */
-       .globl _swapper_pg_dir,_pg0
-       .globl _empty_bad_page
-       .globl _empty_bad_page_table
-       .globl _empty_zero_page
-       .globl _floppy_track_buffer
-_floppy_track_buffer:
+       .globl C_LABEL(swapper_pg_dir), C_LABEL(pg0)
+       .globl C_LABEL(empty_bad_page)
+       .globl C_LABEL(empty_bad_page_table)
+       .globl C_LABEL(empty_zero_page)
+       .globl C_LABEL(floppy_track_buffer)
+C_LABEL(floppy_track_buffer):
        .fill 512*2*36,1,0
 
        .align 4
-_swapper_pg_dir:       .skip 0x1000
-_pg0:                  .skip 0x1000
-_empty_bad_page:       .skip 0x1000
-_empty_bad_page_table: .skip 0x1000
-_empty_zero_page:      .skip 0x1000
+C_LABEL(swapper_pg_dir):               .skip 0x1000
+C_LABEL(pg0):                          .skip 0x1000
+C_LABEL(empty_bad_page):               .skip 0x1000
+C_LABEL(empty_bad_page_table):         .skip 0x1000
+C_LABEL(empty_zero_page):              .skip 0x1000
 
diff --git a/arch/sparc/kernel/idprom.c b/arch/sparc/kernel/idprom.c
new file mode 100644 (file)
index 0000000..c12f746
--- /dev/null
@@ -0,0 +1,183 @@
+/* idprom.c: Routines to load the idprom into kernel addresses and
+ *           interpret the data contained within.
+ *
+ * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
+ */
+
+#include <linux/kernel.h>
+
+#include <asm/types.h>
+#include <asm/openprom.h>
+#include <asm/idprom.h>
+
+struct idp_struct idprom;
+extern int num_segmaps, num_contexts;
+
+void get_idprom(void)
+{
+  char* idp_addr;
+  char* knl_idp_addr;
+  int i;
+
+  idp_addr = (char *)IDPROM_ADDR;
+  knl_idp_addr = (char *) &idprom;
+
+  for(i = 0; i<IDPROM_SIZE; i++)
+      *knl_idp_addr++ = *idp_addr++;
+
+  return;
+}
+
+/* find_vac_size() returns the number of bytes in the VAC (virtual
+ * address cache) on this machine.
+ */
+
+int
+find_vac_size(void)
+{
+  int vac_prop_len;
+  int vacsize = 0;
+  int node_root;
+
+  node_root = (*(romvec->pv_nodeops->no_nextnode))(0);
+
+  vac_prop_len = (*(romvec->pv_nodeops->no_proplen))(node_root, "vac-size");
+
+  if(vac_prop_len != -1)
+    {
+      (*(romvec->pv_nodeops->no_getprop))(node_root, "vac-size", (char *) &vacsize);
+      return vacsize;
+    }
+  else
+    {
+
+  /* The prom node functions can't help, do it via idprom struct */
+      switch(idprom.id_machtype)
+       {
+       case 0x51:
+       case 0x52:
+       case 0x53:
+       case 0x54:
+       case 0x55:
+       case 0x56:
+       case 0x57:
+         return 65536;
+       default:
+         return -1;
+       }
+    };
+}
+
+/* find_vac_linesize() returns the size in bytes of the VAC linesize */ 
+
+int
+find_vac_linesize(void)
+{
+  int vac_prop_len;
+  int vaclinesize = 0;
+  int node_root;
+
+  node_root = (*(romvec->pv_nodeops->no_nextnode))(0);
+
+  vac_prop_len = (*(romvec->pv_nodeops->no_proplen))(node_root, "vac-linesize");
+
+  if(vac_prop_len != -1)
+    {
+      (*(romvec->pv_nodeops->no_getprop))(node_root, "vac-linesize",
+                                     (char *) &vaclinesize);
+      return vaclinesize;
+    }
+  else
+    {
+
+  /* The prom node functions can't help, do it via idprom struct */
+      switch(idprom.id_machtype)
+       {
+       case 0x51:
+       case 0x52:
+       case 0x53:
+       case 0x54:
+         return 16;
+       case 0x55:
+       case 0x56:
+       case 0x57:
+         return 32;
+       default:
+         return -1;
+       }
+    };
+}
+
+int
+find_vac_hwflushes(void)
+{
+  register int len, node_root;
+  int tmp1, tmp2;
+
+  node_root = (*(romvec->pv_nodeops->no_nextnode))(0);
+
+  len = (*(romvec->pv_nodeops->no_proplen))(node_root, "vac_hwflush");
+
+#ifdef DEBUG_IDPROM
+  printf("DEBUG: find_vac_hwflushes: proplen vac_hwflush=0x%x\n", len);
+#endif
+
+  /* Sun 4/75 has typo in prom_node, it's a dash instead of an underscore
+   * in the property name. :-(
+   */
+  len |= (*(romvec->pv_nodeops->no_proplen))(node_root, "vac-hwflush");
+
+#ifdef DEBUG_IDPROM
+  printf("DEBUG: find_vac_hwflushes: proplen vac-hwflush=0x%x\n", len);
+#endif
+
+  len = (*(romvec->pv_nodeops->no_getprop))(node_root,"vac_hwflush", 
+                                           (char *) &tmp1);
+  if(len != 4) tmp1=0;
+
+  len = (*(romvec->pv_nodeops->no_getprop))(node_root, "vac-hwflush",
+                                           (char *) &tmp2);
+  if(len != 4) tmp2=0;
+
+
+  return (tmp1|tmp2);
+}
+
+void
+find_mmu_num_segmaps(void)
+{
+  register int root_node, len;
+
+  root_node = (*(romvec->pv_nodeops->no_nextnode))(0);
+
+  len = (*(romvec->pv_nodeops->no_getprop))(root_node, "mmu-npmg", 
+                                           (char *) &num_segmaps);
+
+#ifdef DEBUG_MMU
+  printf("find_mmu_num_segmaps: property length = %d\n", len);
+#endif
+
+  if(len != 4) num_segmaps = 128;
+
+  return;
+}
+
+void
+find_mmu_num_contexts(void)
+{
+  register int root_node, len;
+
+  root_node = (*(romvec->pv_nodeops->no_nextnode))(0);
+
+  len = (*(romvec->pv_nodeops->no_getprop))(root_node, "mmu-nctx", 
+                                           (char *) &num_contexts);
+
+#ifdef DEBUG_MMU
+  printf("find_mmu_num_contexts: property length = %d\n", len);
+#endif
+
+  if(len != 4) num_contexts = 8;
+
+  return;
+}
+
index 9596bb6736260cf7715e9c596414c69c7072385d..b70a256ce4c7468aa6f9d7c9d5e60038be942079 100644 (file)
@@ -1,6 +1,6 @@
 /* ioport.c:  I/O access on the Sparc. Work in progress.. Most of the things
  *            in this file are for the sole purpose of getting the kernel
- *           through the compiler. :-)
+ *           throught the compiler. :-)
  *
  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  */
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/ioport.h>
-
-/*
- * this changes the io permissions bitmap in the current task.
- */
-asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int turn_on)
-{
-       return 0;
-}
diff --git a/arch/sparc/kernel/probe.c b/arch/sparc/kernel/probe.c
new file mode 100644 (file)
index 0000000..5c509f7
--- /dev/null
@@ -0,0 +1,403 @@
+/* probe.c: Preliminary device tree probing routines...
+
+   Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
+*/
+
+#include <linux/kernel.h>
+#include <asm/vac-ops.h>
+
+/* #define DEBUG_PROBING */
+
+char promstr_buf[64];         /* overkill */
+unsigned int promint_buf[1];
+
+extern int prom_node_root;
+extern int num_segmaps, num_contexts;
+
+extern int node_get_sibling(int node);
+extern int node_get_child(int node);
+extern char* get_str_from_prom(int node, char* name, char* value);
+extern unsigned int* get_int_from_prom(int node, char* name, unsigned int *value);
+
+/* Cpu-type information and manufacturer strings */
+
+
+struct cpu_iu_info {
+  int psr_impl;
+  int psr_vers;
+  char* cpu_name;   /* should be enough I hope... */
+};
+
+struct cpu_fp_info {
+  int psr_impl;
+  int fp_vers;
+  char* fp_name;
+};
+
+struct cpu_fp_info linux_sparc_fpu[] = {
+  { 0, 0, "Fujitsu MB86910 or Weitek WTL1164/5"},
+  { 0, 1, "Fujitsu MB86911 or Weitek WTL1164/5"},
+  { 0, 2, "LSI Logic L64802 or Texas Instruments ACT8847"},
+  { 0, 3, "Weitek WTL3170/2"},
+  { 0, 4, "Lsi Logic/Meiko L64804"},
+  { 0, 5, "reserved"},
+  { 0, 6, "reserved"},
+  { 0, 7, "No FPU"},
+  { 1, 0, "Lsi Logic L64812 or Texas Instruments ACT8847"},
+  { 1, 1, "Lsi Logic L64814"},
+  { 1, 2, "Texas Instruments TMS390-C602A"},
+  { 1, 3, "Weitek WTL3171"},
+  { 1, 4, "reserved"},
+  { 1, 5, "reserved"},
+  { 1, 6, "reserved"},
+  { 1, 7, "No FPU"},
+  { 2, 0, "BIT B5010 or B5110/20 or B5210"},
+  { 2, 1, "reserved"},
+  { 2, 2, "reserved"},
+  { 2, 3, "reserved"},
+  { 2, 4,  "reserved"},
+  { 2, 5, "reserved"},
+  { 2, 6, "reserved"},
+  { 2, 7, "No FPU"},
+  { 5, 0, "Matsushita MN10501"},
+  { 5, 1, "reserved"},
+  { 5, 2, "reserved"},
+  { 5, 3, "reserved"},
+  { 5, 4, "reserved"},
+  { 5, 5, "reserved"},
+  { 5, 6, "reserved"},
+  { 5, 7, "No FPU"},
+};
+
+struct cpu_iu_info linux_sparc_chips[] = {
+  { 0, 0, "Fujitsu Microelectronics, Inc. - MB86900/1A"},
+  { 1, 0, "Cypress CY7C601"},
+  { 1, 1, "LSI Logic Corporation - L64811"},
+  { 1, 3, "Cypress CY7C611"},
+  { 2, 0, "Bipolar Integrated Technology - B5010"},
+  { 3, 0, "LSI Logic Corporation - unknown-type"},
+  { 4, 0, "Texas Instruments, Inc. - unknown"},
+  { 4, 1, "Texas Instruments, Inc. - unknown"},
+  { 4, 2, "Texas Instruments, Inc. - unknown"},
+  { 4, 3, "Texas Instruments, Inc. - unknown"},
+  { 4, 4, "Texas Instruments, Inc. - unknown"},
+  { 4, 5, "Texas Instruments, Inc. - unknown"},
+  { 5, 0, "Matsushita - MN10501"},
+  { 6, 0, "Philips Corporation - unknown"},
+  { 7, 0, "Harvest VLSI Design Center, Inc. - unknown"},
+  { 8, 0, "Systems and Processes Engineering Corporation (SPEC)"},
+  { 9, 0, "UNKNOWN CPU-VENDOR/TYPE"},
+  { 0xa, 0, "UNKNOWN CPU-VENDOR/TYPE"},
+  { 0xb, 0, "UNKNOWN CPU-VENDOR/TYPE"},
+  { 0xc, 0, "UNKNOWN CPU-VENDOR/TYPE"},
+  { 0xd, 0, "UNKNOWN CPU-VENDOR/TYPE"},
+  { 0xe, 0, "UNKNOWN CPU-VENDOR/TYPE"},
+  { 0xf, 0, "UNKNOWN CPU-VENDOR/TYPE"},
+};
+
+char *sparc_cpu_type = "cpu-oops";
+char *sparc_fpu_type = "fpu-oops";
+
+/* various Virtual Address Cache parameters we find at boot time... */
+
+extern int vac_size, vac_linesize, vac_do_hw_vac_flushes;
+extern int vac_entries_per_context, vac_entries_per_segment;
+extern int vac_entries_per_page;
+
+extern int find_vac_size(void);
+extern int find_vac_linesize(void);
+extern int find_vac_hwflushes(void);
+extern void find_mmu_num_segmaps(void);
+extern void find_mmu_num_contexts(void);
+
+void
+probe_cpu(void)
+{
+  register int psr_impl, psr_vers, fpu_vers, i;
+  unsigned int tmp_fsr;
+
+  &tmp_fsr;   /* GCC grrr... */
+
+  __asm__("rd %%psr, %0\n\t"
+         "mov %0, %1\n\t"
+         "srl %0, 28, %0\n\t"
+         "srl %1, 24, %1\n\t"
+         "and %0, 0xf, %0\n\t"
+         "and %1, 0xf, %1\n\t" :
+         "=r" (psr_impl),
+         "=r" (psr_vers) :
+         "0" (psr_impl),
+         "1" (psr_vers));
+
+
+  __asm__("st %%fsr, %1\n\t"
+         "ld %1, %0\n\t"
+         "srl %0, 17, %0\n\t"
+         "and %0, 0x7, %0\n\t" :
+         "=r" (fpu_vers),
+         "=m" (tmp_fsr) :
+         "0" (fpu_vers),
+         "1" (tmp_fsr));
+
+  printk("fpu_vers: %d ", fpu_vers);
+  printk("psr_impl: %d ", psr_impl);
+  printk("psr_vers: %d \n\n", psr_vers);
+
+  for(i = 0; i<23; i++)
+    {
+      if(linux_sparc_chips[i].psr_impl == psr_impl)
+       if(linux_sparc_chips[i].psr_vers == psr_vers)
+         {
+           sparc_cpu_type = linux_sparc_chips[i].cpu_name;
+           break;
+         }
+    }
+
+  if(i==23)
+    {
+      printk("No CPU type! You lose\n");
+      printk("DEBUG: psr.impl = 0x%x   psr.vers = 0x%x\n", psr_impl, 
+            psr_vers);
+      return;
+    }
+
+  for(i = 0; i<32; i++)
+    {
+      if(linux_sparc_fpu[i].psr_impl == psr_impl)
+       if(linux_sparc_fpu[i].fp_vers == fpu_vers)
+         {
+           sparc_fpu_type = linux_sparc_fpu[i].fp_name;
+           break;
+         }
+    }
+
+  if(i == 32)
+    {
+      printk("No FPU type! You don't completely lose though...\n");
+      printk("DEBUG: psr.impl = 0x%x  fsr.vers = 0x%x\n", psr_impl, fpu_vers);
+      sparc_fpu_type = linux_sparc_fpu[31].fp_name;
+    }
+
+  printk("CPU: %s \n", sparc_cpu_type);
+  printk("FPU: %s \n", sparc_fpu_type);
+
+  return;
+}
+
+void
+probe_vac(void)
+{
+  register unsigned int x,y;
+
+  vac_size = find_vac_size();
+  vac_linesize = find_vac_linesize();
+  vac_do_hw_vac_flushes = find_vac_hwflushes();
+
+  /* Calculate various constants that make the cache-flushing code
+   * mode speedy.
+   */
+
+  vac_entries_per_segment = vac_entries_per_context = vac_size >> 12;
+
+  for(x=0,y=vac_linesize; ((1<<x)<y); x++);
+  if((1<<x) != vac_linesize) printk("Warning BOGUS VAC linesize 0x%x",
+                                   vac_size);
+
+  vac_entries_per_page = x;
+
+  printk("Sparc VAC cache: Size=%d bytes  Line-Size=%d bytes ... ", vac_size,
+        vac_linesize);
+
+  /* Here we want to 'invalidate' all the software VAC "tags"
+   * just in case there is garbage in there. Then we enable it.
+   */
+
+  for(x=0x80000000, y=(x+vac_size); x<y; x+=vac_linesize)
+    __asm__("sta %0, [%1] %2" : : "r" (0), "r" (x), "n" (0x2));
+
+  x=enable_vac();
+  printk("ENABLED\n");
+
+  return;
+}
+
+void
+probe_mmu(void)
+{
+  find_mmu_num_segmaps();
+  find_mmu_num_contexts();
+
+  printk("\nMMU segmaps: %d     MMU contexts: %d\n", num_segmaps, 
+        num_contexts);
+
+  return;
+}
+
+void
+probe_clock(int fchild)
+{
+  /* TODO :> I just can't stomache it right now... */
+  return;
+}
+
+
+void
+probe_esp(register int esp_node)
+{
+  register int nd;
+  register char* lbuf;
+
+  nd = node_get_child(esp_node);
+
+  printk("\nProbing ESP:\n");
+  lbuf = get_str_from_prom(nd, "name", promstr_buf);
+
+  printk("\nProperty length for %s: 0x%x\n", "name", 
+        *get_int_from_prom(nd, "name", promint_buf));
+
+  if(*get_int_from_prom(nd, "name", promint_buf) != 0)
+  printk("Node: 0x%x Name: %s", nd, lbuf);
+
+  lbuf = get_str_from_prom(nd, "device-type", promstr_buf);
+
+  printk("\nProperty length for %s: 0x%x\n", "device_type", 
+        *get_int_from_prom(nd, "device_type", promint_buf));
+
+  if(*get_int_from_prom(nd, "device-type", promint_buf) != 0)
+    printk("Device-Type: %s ", lbuf);
+  
+  lbuf = get_str_from_prom(nd, "model", promstr_buf);
+
+  printk("\nProperty length for %s: 0x%x\n", "model", 
+        *get_int_from_prom(nd, "model", promint_buf));
+
+  if(*get_int_from_prom(nd, "model", promint_buf) != 0)
+    printk("Model: %s", lbuf);
+
+  printk("\n");
+
+  while((nd = node_get_sibling(nd)) != 0)
+    {
+      lbuf = get_str_from_prom(nd, "name", promstr_buf);
+
+      if(*get_int_from_prom(nd, "name", promint_buf) != 0)
+      printk("Node: 0x%x Name: %s ", nd, lbuf);
+
+      lbuf = get_str_from_prom(nd, "device-type", promstr_buf);
+
+      if(*get_int_from_prom(nd, "device-type", promint_buf) != 0)
+      printk("Device-Type: %s ", lbuf);
+
+      lbuf = get_str_from_prom(nd, "model", promstr_buf);
+
+      if(*get_int_from_prom(nd, "model", promint_buf) != 0)
+      printk("Model: %s", lbuf);
+
+      printk("\n");
+    }
+
+  printk("\n");
+
+  return;
+}
+
+void
+probe_sbus(register int cpu_child_node)
+{
+  register int nd, savend;
+  register char* lbuf;
+
+  nd = cpu_child_node;
+
+  lbuf = (char *) 0;
+
+  while((nd = node_get_sibling(nd)) != 0)
+    {
+      lbuf = get_str_from_prom(nd, "name", promstr_buf);
+      if(lbuf[0]=='s' && lbuf[1]=='b' && lbuf[2]=='u' && lbuf[3]=='s')
+       break;
+    }
+  nd = node_get_child(nd);
+
+  printk("Node: 0x%x Name: %s\n", nd,
+        get_str_from_prom(nd, "name", promstr_buf));
+
+  if(lbuf[0]=='e' && lbuf[1]=='s' && lbuf[2]=='p')
+    probe_esp(nd);
+
+  while((nd = node_get_sibling(nd)) != 0)
+    {
+      printk("Node: 0x%x Name: %s\n", nd,
+            get_str_from_prom(nd, "name", promstr_buf));
+
+         if(lbuf[0]=='e' && lbuf[1]=='s' && lbuf[2]=='p')
+           {
+             savend = nd;
+             probe_esp(nd);
+             nd = savend;
+           }
+    }
+
+  return;
+}
+
+void
+probe_devices(void)
+{
+  register int nd, first_descent;
+  register char* str;
+
+  nd = prom_node_root;
+
+  printk("PROBING DEVICES:\n");
+
+  str = get_str_from_prom(nd, "device_type", promstr_buf);
+  printk("Root Node: 0x%x ", nd);
+
+#ifdef DEBUG_PROBING
+  printk("String address for d_type: 0x%x\n", (unsigned int) str);
+  printk("str[0] = %c  str[1] = %c  str[2] = %c \n", str[0], str[1], str[2]);
+#endif
+
+  printk("Device Type: %s ", str);
+
+  str = get_str_from_prom(nd, "name", promstr_buf);
+
+#ifdef DEBUG_PROBING
+  printk("String address for name: 0x%x\n", (unsigned int) str);
+  printk("str[0] = %c  str[1] = %c  str[2] = %c \n", str[0], str[1], str[2]);
+#endif
+
+  printk("Name: %s \n", str);
+
+  first_descent = nd = node_get_child(nd);
+
+
+/* Ok, here will go a call to each specific device probe. We can
+   call these now that we have the 'root' node and the child of
+   this node to send to the routines. ORDER IS IMPORTANT!
+*/
+
+  probe_cpu();
+  probe_vac();
+  probe_mmu();
+  probe_clock(first_descent);
+
+/*
+  printk("PROM Root Child Node: 0x%x Name: %s \n", nd,
+        get_str_from_prom(nd, "name", promstr_buf));
+
+  while((nd = node_get_sibling(nd)) != 0)
+    {
+
+      printk("Node: 0x%x Name: %s\n", nd,
+            get_str_from_prom(nd, "name", promstr_buf));
+
+    }
+
+  printk("\nProbing SBUS:\n");
+  probe_sbus(first_descent);
+*/
+
+  return;
+}
index 4714a2b99bb1796ac8080a61b7c4a91867e997fb..5d6d38355f757bb3bafc1bff58be34552102c828 100644 (file)
@@ -39,12 +39,15 @@ asmlinkage int sys_idle(void)
        /* endless idle loop with no priority at all */
        current->counter = -100;
        for (;;) {
-               if (!need_resched)
-                       __asm__("nop");
                schedule();
        }
 }
 
+void hard_reset_now(void)
+{
+       halt();
+}
+
 /*
  * Do necessary setup to start up a newly executed thread.
  */
@@ -59,12 +62,12 @@ void start_thread(struct pt_regs * regs, unsigned long sp, unsigned long fp)
  */
 void exit_thread(void)
 {
-  return; /* i'm getting to it */
+  halt();
 }
 
 void flush_thread(void)
 {
-  return;
+  halt();
 }
 
 unsigned long copy_thread(int nr, unsigned long clone_flags, struct task_struct * p, struct pt_regs * regs)
@@ -91,19 +94,7 @@ void dump_thread(struct pt_regs * regs, struct user * dump)
  */
 asmlinkage int sys_execve(struct pt_regs regs)
 {
-       int error;
-       char * filename;
-
-       error = do_execve(filename, (char **) regs.u_regs[0], 
-                         (char **) regs.u_regs[1], &regs);
-       putname(filename);
-       return error;
+  halt();
+  return 0;
 }
 
-/*
- * Bogon bios32 stuff...
- */
-unsigned long bios32_init(unsigned long memory_start, unsigned long memory_end)
-{
-  return memory_start;
-}
index 89f6b2bac816d10a32efc0f99f7c66bef5ec1101..7dd07b33a130da7adc4e1ac85ad7b3aefadf3d1a 100644 (file)
@@ -4,10 +4,92 @@
  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  */
 
+#include <linux/kernel.h>
+
 #include <asm/openprom.h>
 
+#define DEBUG_PROMOPS
+#define MAX_PR_LEN   16           /* exotic hardware probably overshoots this */
+
+int prom_node_root;               /* initialized in init_prom */
+
 extern struct linux_romvec *romvec;
 
+/* These two functions return and siblings and direct child descendents
+ * in the prom device tree respectively.
+ */
+
+int
+node_get_sibling(int node)
+{
+  return (*(romvec->pv_nodeops->no_nextnode))(node);
+}
+
+int
+node_get_child(int node)
+{
+  return (*(romvec->pv_nodeops->no_child))(node);
+}
+
+/* The following routine is used during device probing to determine
+ * an integer value property about a (perhaps virtual) device. This
+ * could be anything, like the size of the mmu cache lines, etc.
+ * the default return value is -1 is the prom has nothing interesting.
+ */
+
+unsigned int *
+get_int_from_prom(int node, char *nd_prop, unsigned int *value)
+{
+  unsigned int pr_len;
+
+  *value = 0;    /* duh, I was returning -1 as an unsigned int, prom_panic() */
+
+  pr_len = romvec->pv_nodeops->no_proplen(node, nd_prop);
+  if(pr_len > MAX_PR_LEN)
+    {
+#ifdef DEBUG_PROMOPS
+      printk("Bad pr_len in promops -- node: %d nd_prop: %s pr_len: %d",
+            node, nd_prop, (int) pr_len);
+#endif
+      return value;      /* XXX */
+    }
+
+  romvec->pv_nodeops->no_getprop(node, nd_prop, (char *) value);
+
+  return value;
+}
+
+
+/* This routine returns what is termed a property string as opposed
+ * to a property integer as above. This can be used to extract the
+ * 'type' of device from the prom. An example could be the clock timer
+ * chip type. By default you get returned a null string if garbage
+ * is returned from the prom.
+ */
+
+char *
+get_str_from_prom(int node, char *nd_prop, char *value)
+{
+  unsigned int pr_len;
+
+  *value='\n';
+
+  pr_len = romvec->pv_nodeops->no_proplen(node, nd_prop);
+  if(pr_len > MAX_PR_LEN)
+    {
+#ifdef DEBUG_PROMOPS
+      printk("Bad pr_len in promops -- node: %d nd_prop: %s pr_len: %d",
+            node, nd_prop, pr_len);
+#endif
+      return value;      /* XXX */
+    }
+
+  romvec->pv_nodeops->no_getprop(node, nd_prop, value);
+  value[pr_len] = 0;
+
+  return value;
+}
+
 /* This gets called from head.S upon bootup to initialize the
  * prom vector pointer for the rest of the kernel.
  */
@@ -16,6 +98,7 @@ void
 init_prom(struct linux_romvec *r_ptr)
 {
   romvec = r_ptr;
+  prom_node_root = romvec->pv_nodeops->no_nextnode(0);
   
   return;
 }
diff --git a/arch/sparc/kernel/setup.c b/arch/sparc/kernel/setup.c
new file mode 100644 (file)
index 0000000..05f0537
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ *  linux/arch/alpha/kernel/setup.c
+ *
+ *  Copyright (C) 1995  David S. Miller (davem@caip.rutgers.edu)
+ */
+
+/*
+ * bootup setup stuff..
+ */
+
+#include <linux/errno.h>
+#include <linux/sched.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/stddef.h>
+#include <linux/unistd.h>
+#include <linux/ptrace.h>
+#include <linux/malloc.h>
+#include <linux/ldt.h>
+#include <linux/user.h>
+#include <linux/a.out.h>
+#include <linux/tty.h>
+
+#include <asm/segment.h>
+#include <asm/system.h>
+#include <asm/io.h>
+#include <asm/openprom.h>   /* for console registration + cheese */
+
+extern void get_idprom(void);
+extern void probe_devices(void);
+
+/*
+ * Gcc is hard to keep happy ;-)
+ */
+struct screen_info screen_info = {
+       0, 0,                   /* orig-x, orig-y */
+       { 0, 0, },              /* unused */
+       0,                      /* orig-video-page */
+       0,                      /* orig-video-mode */
+       80,                     /* orig-video-cols */
+       0,0,0,                  /* ega_ax, ega_bx, ega_cx */
+       25                      /* orig-video-lines */
+};
+
+/* At least I hide the sneaky floppy_track_buffer in my dirty assembly
+ * code. ;-)
+ */
+
+unsigned long bios32_init(unsigned long memory_start, unsigned long memory_end)
+{
+       return memory_start;
+}
+
+/* Lame prom console routines, gets registered below. Thanks for the
+ * tip Linus.
+ */
+
+void sparc_console_print(const char * p)
+{
+  unsigned char c;
+
+       while ((c = *(p++)) != 0)
+         {
+           if (c == '\n') romvec->pv_putchar('\r');
+           (*(romvec->pv_putchar))(c);
+         }
+
+  return;
+
+}
+
+/* This routine will in the future do all the nasty prom stuff
+ * to probe for the mmu type and it's parameters, etc. This will
+ * also be where SMP things happen plus the Sparc specific memory
+ * physical memory probe as on the alpha.
+ */
+
+extern void register_console(void (*proc)(const char *));
+
+void setup_arch(char **cmdline_p,
+       unsigned long * memory_start_p, unsigned long * memory_end_p)
+{
+       extern int _end;
+
+       register_console(sparc_console_print);
+
+       printk("Sparc PROM-Console registered...\n");
+
+       printk("calling get_idprom...\n");
+       get_idprom();     /* probe_devices expects this to be done */
+
+       printk("calling probe_devices...\n");
+       probe_devices();  /* cpu/fpu, mmu probes */
+
+       *memory_start_p = (((unsigned long) &end));
+}
+
+asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on)
+{
+       return -EIO;
+}
index 5b3bc519209446a3f126d012787abc031ffc6873..cd949e4ed0658b0273f36e7176897255ff043d49 100644 (file)
@@ -41,10 +41,8 @@ asmlinkage int sys_sigsuspend(int restart, unsigned long oldmask, unsigned long
 
 asmlinkage int sys_sigreturn(unsigned long __unused)
 {
-  __unused=1;
-
-  do_exit(SIGSEGV);
-  return __unused;
+  halt();
+  return 0;
 }
 
 /*
@@ -54,7 +52,7 @@ asmlinkage int sys_sigreturn(unsigned long __unused)
 void setup_frame(struct sigaction * sa, unsigned long ** fp, unsigned long eip,
        struct pt_regs * regs, int signr, unsigned long oldmask)
 {
-  return;
+  halt();
 }
 
 /*
@@ -68,5 +66,6 @@ void setup_frame(struct sigaction * sa, unsigned long ** fp, unsigned long eip,
  */
 asmlinkage int do_signal(unsigned long oldmask, struct pt_regs * regs)
 {
-       return 1;
+  halt();
+  return 1;
 }
index 7791c6ded960a1f25840bc2da19eee2a47be6f92..1f2ce0e1cea12a933d08e8f9d8ab1d33aa531b56 100644 (file)
@@ -2,6 +2,8 @@
 # Makefile for Sparc library files..
 #
 
+CFLAGS := $(CFLAGS) -ansi
+
 .c.s:
        $(CC) $(CFLAGS) -S $<
 .s.o:
index a07abed1e83651d60bf7d480d35c8a56d086f0ca..c672d2c9f9f73d4626f193e66b3c8996b64746e0 100644 (file)
@@ -4,8 +4,10 @@
  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  */
 
-               .globl ___ashrdi3
-___ashrdi3:
+#include <asm/cprefix.h>
+
+               .globl C_LABEL(__ashrdi3)
+C_LABEL(__ashrdi3):
        tst     %o2
        be      3f
        or      %g0, 32, %g2
index bd7328f0b95ac98314f2fd51eefcb4667feac332..a4148d0136005082f0db5fd244841f9aa1e55d77 100644 (file)
@@ -14,7 +14,7 @@
 .c.s:
        $(CC) $(CFLAGS) -S $<
 
-OBJS   = fault.o vac-flush.o
+OBJS   = fault.o vac-flush.o init.o
 
 mm.o: $(OBJS)
        $(LD) -r -o mm.o $(OBJS)
index c28df1a679d3b56a5755bd3f771eca1007ae88f7..329e9d0eb3b65a274e13b213f98387a0d693195a 100644 (file)
 #include <asm/page.h>
 
 extern unsigned long pg0[1024];                /* page table for 0-4MB for everybody */
-
-extern void scsi_mem_init(unsigned long);
-extern void sound_mem_init(void);
 extern void die_if_kernel(char *,struct pt_regs *,long);
-extern void show_net_buffers(void);
 
 /* Sparc stuff... I know this is a ugly place to put the PROM vector, don't
  * remind me.
  */
-extern char* trapbase;
+extern unsigned int trapbase[];
 extern unsigned int end[], etext[], msgbuf[];
 struct linux_romvec *romvec;
 
@@ -170,218 +166,6 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code)
        do_exit(SIGKILL);
 }
 
-/*
- * BAD_PAGE is the page that is used for page faults when linux
- * is out-of-memory. Older versions of linux just did a
- * do_exit(), but using this instead means there is less risk
- * for a process dying in kernel mode, possibly leaving a inode
- * unused etc..
- *
- * BAD_PAGETABLE is the accompanying page-table: it is initialized
- * to point to BAD_PAGE entries.
- *
- * ZERO_PAGE is a special page that is used for zero-initialized
- * data and COW.
- */
-unsigned long __bad_pagetable(void)
-{
-       extern char empty_bad_page_table[PAGE_SIZE];
-
-       return (unsigned long) empty_bad_page_table;
-}
-
-unsigned long __bad_page(void)
-{
-       extern char empty_bad_page[PAGE_SIZE];
-
-       return (unsigned long) empty_bad_page;
-}
-
-unsigned long __zero_page(void)
-{
-       extern char empty_zero_page[PAGE_SIZE];
-
-       return (unsigned long) empty_zero_page;
-}
-
-void show_mem(void)
-{
-       int i=0,free = 0,total = 0,reserved = 0;
-       int shared = 0;
-
-       printk("Mem-info:\n");
-       show_free_areas();
-       printk("Free swap:       %6dkB\n",nr_swap_pages<<(PAGE_SHIFT-10));
-       i = high_memory >> PAGE_SHIFT;
-       while (i-- > 0) {
-               total++;
-               if (mem_map[i] & MAP_PAGE_RESERVED)
-                       reserved++;
-               else if (!mem_map[i])
-                       free++;
-               else
-                       shared += mem_map[i]-1;
-       }
-       printk("%d pages of RAM\n",total);
-       printk("%d free pages\n",free);
-       printk("%d reserved pages\n",reserved);
-       printk("%d pages shared\n",shared);
-       show_buffers();
-#ifdef CONFIG_NET
-       show_net_buffers();
-#endif
-}
-
-extern unsigned long free_area_init(unsigned long, unsigned long);
-
-/*
- * paging_init() sets up the page tables - note that the first 4MB are
- * already mapped by head.S.
- *
- * This routines also unmaps the page at virtual kernel address 0, so
- * that we can trap those pesky NULL-reference errors in the kernel.
- */
-unsigned long paging_init(unsigned long start_mem, unsigned long end_mem)
-{
-       int pg_segmap;
-       unsigned long i, a, b, mask=0;
-       register int num_segs, num_ctx;
-       register char * c;
-
-       num_segs = num_segmaps;
-       num_ctx = num_contexts;
-
-       num_segs -= 1;
-       invalid_segment = num_segs;
-
-/* On the sparc we first need to allocate the segmaps for the
- * PROM's virtual space, and make those segmaps unusable. We
- * map the PROM in ALL contexts therefore the break key and the
- * sync command work no matter what state you took the machine
- * out of
- */
-
-       printk("mapping the prom...\n");
-       num_segs = map_the_prom(num_segs);
-
-       start_mem = PAGE_ALIGN(start_mem);
-
-       /* ok, allocate the kernel pages, map them in all contexts
-        * (with help from the prom), and lock them. Isn't the sparc
-        * fun kiddies? TODO
-        */
 
-       b=PGDIR_ALIGN(start_mem)>>18;
-       c= (char *)0x0;
 
-       printk("mapping kernel in all contexts...\n");
 
-       for(a=0; a<b; a++)
-         {
-           for(i=1; i<num_contexts; i++)
-             {
-               /* map the kernel virt_addrs */
-               (*(romvec->pv_setctxt))(i, (char *) c, a);
-               c += 4096;
-             }
-         }
-
-       /* Ok, since now mapped in all contexts, we can free up
-        * context zero to be used amongst user processes.
-        */
-
-       /* free context 0 here TODO */
-
-       /* invalidate all user pages and initialize the pte struct 
-        * for userland. TODO
-        */
-
-       /* Make the kernel text unwritable and cacheable, the prom
-        * loaded out text as writable, only sneaky sunos kernels need
-        * self-modifying code.
-        */
-
-       a= (unsigned long) etext;
-       b=PAGE_ALIGN((unsigned long) msgbuf);
-       mask=~(PTE_NC|PTE_W);    /* make cacheable + not writable */
-
-       printk("changing kernel text perms...\n");
-
-
-       /* must do for every segment since kernel uses all contexts
-        * and unlike some sun kernels I know of, we can't hard wire
-        * context 0 just for the kernel, that is unnecessary.
-        */
-
-       for(i=0; i<8; i++)
-         {
-           b=PAGE_ALIGN((unsigned long) trapbase);
-
-           switch_to_context(i);
-
-           for(;b<a; b+=4096)
-             {
-               put_pte(b, (get_pte(b) & mask));
-             }
-         }
-
-       invalidate(); /* flush the virtual address cache */
-
-       printk("\nCurrently in context - ");
-       for(i=0; i<num_contexts; i++)
-         {
-           switch_to_context(i);
-           printk("%d ", (int) i);
-         }
-
-       switch_to_context(0);
-
-       /* invalidate all user segmaps for virt addrs 0-KERNBASE */
-
-       /* WRONG, now I just let the kernel sit in low addresses only
-         * from 0 -- end_kernel just like i386-linux. This will make
-         * mem-code a bit easier to cope with.
-        */
-
-       printk("\ninvalidating user segmaps\n");
-       for(i = 0; i<8; i++)
-         {
-           switch_to_context(i);
-           a=((unsigned long) &end);
-           for(a+=524288, pg_segmap=0; ++pg_segmap<=3584; a+=(1<<18))
-             put_segmap((unsigned long *) a, (invalid_segment&0x7f));
-         }
-
-       printk("wheee! have I sold out yet?\n");
-
-       invalidate();
-       return free_area_init(start_mem, end_mem);
-}
-
-void mem_init(unsigned long start_low_mem,
-             unsigned long start_mem, unsigned long end_mem)
-{
-       return;
-}
-
-void si_meminfo(struct sysinfo *val)
-{
-       int i;
-
-       i = high_memory >> PAGE_SHIFT;
-       val->totalram = 0;
-       val->sharedram = 0;
-       val->freeram = nr_free_pages << PAGE_SHIFT;
-       val->bufferram = buffermem;
-       while (i-- > 0)  {
-               if (mem_map[i] & MAP_PAGE_RESERVED)
-                       continue;
-               val->totalram++;
-               if (!mem_map[i])
-                       continue;
-               val->sharedram += mem_map[i]-1;
-       }
-       val->totalram <<= PAGE_SHIFT;
-       val->sharedram <<= PAGE_SHIFT;
-       return;
-}
diff --git a/arch/sparc/mm/init.c b/arch/sparc/mm/init.c
new file mode 100644 (file)
index 0000000..e77f4db
--- /dev/null
@@ -0,0 +1,244 @@
+/*
+ *  linux/arch/sparc/mm/init.c
+ *
+ *  Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
+ */
+
+#include <linux/config.h>
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/head.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/string.h>
+#include <linux/types.h>
+#include <linux/ptrace.h>
+#include <linux/mman.h>
+#include <linux/mm.h>
+
+#include <asm/system.h>
+#include <asm/segment.h>
+#include <asm/vac-ops.h>
+
+extern void scsi_mem_init(unsigned long);
+extern void sound_mem_init(void);
+extern void die_if_kernel(char *,struct pt_regs *,long);
+extern void show_net_buffers(void);
+
+extern int map_the_prom(int);
+
+extern int invalid_segment, num_segmaps, num_contexts;
+
+/*
+ * BAD_PAGE is the page that is used for page faults when linux
+ * is out-of-memory. Older versions of linux just did a
+ * do_exit(), but using this instead means there is less risk
+ * for a process dying in kernel mode, possibly leaving a inode
+ * unused etc..
+ *
+ * BAD_PAGETABLE is the accompanying page-table: it is initialized
+ * to point to BAD_PAGE entries.
+ *
+ * ZERO_PAGE is a special page that is used for zero-initialized
+ * data and COW.
+ */
+unsigned long __bad_pagetable(void)
+{
+       memset((void *) EMPTY_PGT, 0, PAGE_SIZE);
+       return EMPTY_PGT;
+}
+
+unsigned long __bad_page(void)
+{
+       memset((void *) EMPTY_PGE, 0, PAGE_SIZE);
+       return EMPTY_PGE;
+}
+
+unsigned long __zero_page(void)
+{
+       memset((void *) ZERO_PGE, 0, PAGE_SIZE);
+       return ZERO_PGE;
+}
+
+void show_mem(void)
+{
+       int i,free = 0,total = 0,reserved = 0;
+       int shared = 0;
+
+       printk("Mem-info:\n");
+       show_free_areas();
+       printk("Free swap:       %6dkB\n",nr_swap_pages<<(PAGE_SHIFT-10));
+       i = high_memory >> PAGE_SHIFT;
+       while (i-- > 0) {
+               total++;
+               if (mem_map[i] & MAP_PAGE_RESERVED)
+                       reserved++;
+               else if (!mem_map[i])
+                       free++;
+               else
+                       shared += mem_map[i]-1;
+       }
+       printk("%d pages of RAM\n",total);
+       printk("%d free pages\n",free);
+       printk("%d reserved pages\n",reserved);
+       printk("%d pages shared\n",shared);
+       show_buffers();
+#ifdef CONFIG_NET
+       show_net_buffers();
+#endif
+}
+
+extern unsigned long free_area_init(unsigned long, unsigned long);
+
+/*
+ * paging_init() sets up the page tables: in the alpha version this actually
+ * unmaps the bootup page table (as we're now in KSEG, so we don't need it).
+ *
+ * The bootup sequence put the virtual page table into high memory: that
+ * means that we cah change the L1 page table by just using VL1p below.
+ */
+
+unsigned long paging_init(unsigned long start_mem, unsigned long end_mem)
+{
+       int pg_segmap = 0;
+       unsigned long i, a, b, mask=0;
+       register int num_segs, num_ctx;
+       register char * c;
+
+       num_segs = num_segmaps;
+       num_ctx = num_contexts;
+
+       num_segs -= 1;
+       invalid_segment = num_segs;
+
+/* On the sparc we first need to allocate the segmaps for the
+ * PROM's virtual space, and make those segmaps unusable. We
+ * map the PROM in ALL contexts therefore the break key and the
+ * sync command work no matter what state you took the machine
+ * out of
+ */
+
+       printk("mapping the prom...\n");
+       num_segs = map_the_prom(num_segs);
+
+       start_mem = PAGE_ALIGN(start_mem);
+
+       /* ok, allocate the kernel pages, map them in all contexts
+        * (with help from the prom), and lock them. Isn't the sparc
+        * fun kiddies? TODO
+        */
+
+       b=PGDIR_ALIGN(start_mem)>>18;
+       c= (char *)0x0;
+
+       printk("mapping kernel in all contexts...\n");
+
+       for(a=0; a<b; a++)
+         {
+           for(i=1; i<num_contexts; i++)
+             {
+               /* map the kernel virt_addrs */
+               (*(romvec->pv_setctxt))(i, (char *) c, a);
+               c += 4096;
+             }
+         }
+
+       /* Ok, since now mapped in all contexts, we can free up
+        * context zero to be used amongst user processes.
+        */
+
+       /* free context 0 here TODO */
+
+       /* invalidate all user pages and initialize the pte struct 
+        * for userland. TODO
+        */
+
+       /* Make the kernel text unwritable and cacheable, the prom
+        * loaded out text as writable, only sneaky sunos kernels need
+        * self-modifying code.
+        */
+
+       a= (unsigned long) etext;
+       mask=~(PTE_NC|PTE_W);    /* make cacheable + not writable */
+
+       printk("changing kernel text perms...\n");
+
+
+       /* must do for every segment since kernel uses all contexts
+        * and unlike some sun kernels I know of, we can't hard wire
+        * context 0 just for the kernel, that is unnecessary.
+        */
+
+       for(i=0; i<8; i++)
+         {
+           b=PAGE_ALIGN((unsigned long) trapbase);
+
+           switch_to_context(i);
+
+           for(;b<a; b+=4096)
+             {
+               put_pte(b, (get_pte(b) & mask));
+             }
+         }
+
+#if 0 /* bogosity */
+       invalidate(); /* flush the virtual address cache */
+#endif /* bletcherous */
+
+       printk("\nCurrently in context - ");
+       for(i=0; i<num_contexts; i++)
+         {
+           switch_to_context(i);
+           printk("%d ", (int) i);
+         }
+
+       switch_to_context(0);
+
+       /* invalidate all user segmaps for virt addrs 0-KERNBASE */
+
+       /* WRONG, now I just let the kernel sit in low addresses only
+         * from 0 -- end_kernel just like i386-linux. This will make
+         * mem-code a bit easier to cope with.
+        */
+
+       printk("\ninvalidating user segmaps\n");
+       for(i = 0; i<8; i++)
+         {
+           switch_to_context(i);
+           a=((unsigned long) &end);
+           for(a+=524288, pg_segmap=0; ++pg_segmap<=3584; a+=(1<<18))
+             put_segmap((unsigned long *) a, (invalid_segment&0x7f));
+         }
+
+       printk("wheee! have I sold out yet?\n");
+
+       invalidate();
+       return free_area_init(start_mem, end_mem);
+}
+
+void mem_init(unsigned long start_mem, unsigned long end_mem)
+{
+       return;
+}
+
+void si_meminfo(struct sysinfo *val)
+{
+       int i;
+
+       i = high_memory >> PAGE_SHIFT;
+       val->totalram = 0;
+       val->sharedram = 0;
+       val->freeram = nr_free_pages << PAGE_SHIFT;
+       val->bufferram = buffermem;
+       while (i-- > 0)  {
+               if (mem_map[i] & MAP_PAGE_RESERVED)
+                       continue;
+               val->totalram++;
+               if (!mem_map[i])
+                       continue;
+               val->sharedram += mem_map[i]-1;
+       }
+       val->totalram <<= PAGE_SHIFT;
+       val->sharedram <<= PAGE_SHIFT;
+       return;
+}
index f06b66fe79a39c310f6aba6af250f3a021ca247e..5af7825b042698e68c856cfc82efceac4b158ab0 100644 (file)
 
 #include <linux/errno.h>
 #include <linux/sched.h>
+#include <linux/mm.h>
 #include <linux/timer.h>
 #include <linux/fs.h>
 #include <linux/kernel.h>
index 9f74d60ced4efbc30bf3e999124f42bb790e6e82..92533f2e0b4f8f822d1f570226e1b5363f09b0b1 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/string.h>
 #include <linux/config.h>
 #include <linux/locks.h>
+#include <linux/mm.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
index 735ab04f473a5a99d1f4b4d774bffd59b750ed60..a38b5ff85209c465ec9d8be74a6915d8f8a0f1a5 100644 (file)
@@ -43,6 +43,7 @@
 #include <linux/errno.h>
 #include <linux/signal.h>
 #include <linux/sched.h>
+#include <linux/mm.h>
 #include <linux/timer.h>
 #include <linux/fs.h>
 #include <linux/kernel.h>
index bd19eebfbd9e6c2497620e6ac72a1edd3510d1c2..bee519148166605b3eb44595a037084483145e77 100644 (file)
@@ -14,6 +14,8 @@
 #include <linux/fs.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
+#include <linux/mm.h>
+
 #include <asm/system.h>
 #include <asm/segment.h>
 
index 465d601990926862b11afa537002b648a305ab45..e3fd9943d9bfd9816890ba8def04336514487b56 100644 (file)
 #include <linux/errno.h>
 
 #include <linux/sched.h>
+#include <linux/mm.h>
 /* #undef DS */
 #include <linux/timer.h>
 #include <linux/fs.h>
index 6cd8808afc7cb934f95bf1ec2b1d57447390cfe2..46cb09957631590652cffeb7c8ed4c5c85fddf64 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <linux/errno.h>
 #include <linux/sched.h>
+#include <linux/mm.h>
 #include <linux/fs.h>
 #include <linux/kernel.h>
 #include <linux/genhd.h>
index 18d27a75241a2ca273ce841b55de0788c97c57ab..87577db3b17b51be0257cc6536066fa33ddcb4f6 100644 (file)
@@ -45,6 +45,8 @@ endif
 ifdef CONFIG_PRINTER
 OBJS := $(OBJS) lp.o
 SRCS := $(SRCS) lp.c
+else
+MODULES := $(MODULES) lp.o
 endif
 
 ifdef CONFIG_MS_BUSMOUSE
@@ -73,8 +75,6 @@ OBJS := $(OBJS) mouse.o
 SRCS := $(SRCS) mouse.c
 endif
 
-MODULES := lp.o
-
 all: char.a
 
 char.a: $(OBJS)
@@ -94,6 +94,7 @@ endif
 
 dep:
        $(CPP) -M $(SRCS) > .depend
+       $(CPP) -M -DMODULE $(MODULES:.o=.c) >> .depend
 
 dummy:
 
index ef74b1dea7e09a5176462f21d3ce678eaa32dddd..7bbec7e404f727ce5788506fae54a64f5aeaa2cc 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/busmouse.h>
 #include <linux/signal.h>
 #include <linux/errno.h>
+#include <linux/mm.h>
 
 #include <asm/io.h>
 #include <asm/segment.h>
index 1870b4b5a816015dd0c75b41dbf6e9161a774448..3e011ddc4b34c07119fdbef24d014d9f6651f7de 100644 (file)
@@ -88,6 +88,7 @@
 #include <linux/kd.h>
 #include <linux/malloc.h>
 #include <linux/major.h>
+#include <linux/mm.h>
 
 #include <asm/io.h>
 #include <asm/system.h>
index 510f4defe38e39978534f7694fcfbb42b3359ec4..447c2366429fcb2e6d7b970243442ef409e08be5 100644 (file)
@@ -182,6 +182,7 @@ static char rcsid[] =
 #include <linux/cyclades.h>
 #include <linux/delay.h>
 #include <linux/major.h>
+#include <linux/mm.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
index 4b70f5f4a2de694b83d89352633288f3dd4f087c..9264da38acd88c1414c3cf86cf21d9135d9f1b36 100644 (file)
@@ -8,6 +8,14 @@
  * LPCAREFUL, LPABORT, LPGETSTATUS added by Chris Metcalf, metcalf@lcs.mit.edu
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#else
+#define MOD_INC_USE_COUNT
+#define MOD_DEC_USE_COUNT
+#endif
+
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/major.h>
@@ -34,14 +42,6 @@ struct lp_struct lp_table[] = {
 }; 
 #define LP_NO 3
 
-#ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
-
 /* Test if printer is ready (and optionally has no error conditions) */
 #define LP_READY(minor, status) \
   ((LP_F(minor) & LP_CAREFUL) ? _LP_CAREFUL_READY(status) : (status & LP_PBUSY))
index d69e051a3709728ea7f814e0654e8a20830e9391..b6a26697c0648ec1cacfacc0dcb840049b5df956 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/tpqic02.h>
 #include <linux/malloc.h>
 #include <linux/mman.h>
+#include <linux/mm.h>
 
 #include <asm/segment.h>
 #include <asm/io.h>
index 993ad9b03d2875e7590037ded3998f116e3f793c..389f2d01c64fd0800f078763bf9697b673ec26c3 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/ptrace.h>
 #include <linux/major.h>
 #include <linux/ioport.h>
+#include <linux/mm.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
index bc0d61dc0c537b040cc6d64a1cc86249c506c7f3..38fd53500504b93f9bbb98050e8b1a9e91fb14ca 100644 (file)
 #include <linux/delay.h>
 #include <linux/tpqic02.h>
 #include <linux/config.h>
+#include <linux/mm.h>
 
 #include <asm/dma.h>
 #include <asm/system.h>
index b7094e7e975e166d27af5416de10f6a6324ea3a3..9e4d1ce6657c51849d76fa2c6892735c3c5c88c8 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/tty.h>
 #include <linux/fcntl.h>
 #include <linux/string.h>
+#include <linux/mm.h>
 
 #include <asm/io.h>
 #include <asm/bitops.h>
index 1dc7a4ec33b432c7bb7d8d4bed67d9c3b59123f9..204c2def466e4b96ffb7adca4e2d915cc672ee8c 100644 (file)
@@ -71,6 +71,12 @@ static char *version =
   The 3c501 board.
   */
 
+#include <linux/config.h>
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/ptrace.h>
@@ -81,7 +87,6 @@ static char *version =
 #include <linux/string.h>
 #include <linux/ioport.h>
 #include <linux/errno.h>
-#include <linux/config.h>
 
 #include <asm/bitops.h>
 #include <asm/io.h>
@@ -90,11 +95,6 @@ static char *version =
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 
-#ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-#endif
-
 extern struct device *init_etherdev(struct device *dev, int sizeof_private,
                                    unsigned long *mem_startp);
 
index 5155d1cda0c7f40902fdc23d8403e3ef00aaa3af..b45082228c90f764b2c6ed1c50d7315ecce3e305 100644 (file)
 static char *version = "3c509.c:1.03 10/8/94 becker@cesdis.gsfc.nasa.gov\n";
 
 #include <linux/config.h>
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/string.h>
@@ -42,11 +47,6 @@ static char *version = "3c509.c:1.03 10/8/94 becker@cesdis.gsfc.nasa.gov\n";
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
-#ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-#endif
-
 
 
 #ifdef EL3_DEBUG
index ba95c3e15ad3303f5068dd6997cadd9c51423e49..55db9f08595f222b95ff2ce4482c64adfc69de3f 100644 (file)
@@ -29,6 +29,11 @@ static char *version =
   The National Semiconductor LAN Databook, and the 3Com 3c503 databook.
   */
 
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/fs.h>
@@ -50,11 +55,6 @@ static char *version =
 
 #include "8390.h"
 
-#ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-#endif
-
 /* These are the operational function interfaces to board-specific
    routines.
        void reset_8390(struct device *dev)
diff --git a/drivers/net/MODULES b/drivers/net/MODULES
deleted file mode 100644 (file)
index cd82b41..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-MODULES = \
-       3c509.o \
-       de600.o \
-       de620.o \
-       3c501.o \
-       apricot.o \
-       eexpress.o \
-       plip.o \
-       8390.o \
-       slip.o \
-       slhc.o \
-       dummy.o \
-       ewrk3.o \
-       depca.o
index e3ef3e160a6b2580c37656a596fd2c5d5b694add..6ac630e69d262c6bdf790dbfe5539324b52d4dab 100644 (file)
@@ -6,7 +6,9 @@
 # This will go away in some future future: hidden configuration files
 # are difficult for users to deal with.
 include CONFIG
-include MODULES
+
+# Build MODULES by appending to this string for every driver below
+MODULES :=
 
 NETDRV_OBJS := Space.o auto_irq.o net_init.o loopback.o
 CFLAGS := $(CFLAGS) -I../../net/inet
@@ -31,30 +33,30 @@ endif
 ifdef CONFIG_WD80x3
 NETDRV_OBJS := $(NETDRV_OBJS) wd.o
 CONFIG_8390 = CONFIG_8390
+endif
 wd.o:  wd.c CONFIG
        $(CC) $(CPPFLAGS) $(CFLAGS) $(WD_OPTS) -c $<
-endif
 
 ifdef CONFIG_EL2
 NETDRV_OBJS := $(NETDRV_OBJS) 3c503.o
 CONFIG_8390 = CONFIG_8390
+endif
 3c503.o:       3c503.c CONFIG
        $(CC) $(CPPFLAGS) $(CFLAGS) $(EL2_OPTS) -c $<
-endif
 
 ifdef CONFIG_NE2000
 NETDRV_OBJS := $(NETDRV_OBJS) ne.o
 CONFIG_8390 = CONFIG_8390
+endif
 ne.o:  ne.c CONFIG
        $(CC) $(CPPFLAGS) $(CFLAGS) $(NE_OPTS) -c $<
-endif
 
 ifdef CONFIG_HPLAN
 NETDRV_OBJS := $(NETDRV_OBJS) hp.o
 CONFIG_8390 = CONFIG_8390
+endif
 hp.o:  hp.c CONFIG
        $(CC) $(CPPFLAGS) $(CFLAGS) $(HP_OPTS) -c $<
-endif
 
 ifdef CONFIG_HPLAN_PLUS
 NETDRV_OBJS := $(NETDRV_OBJS) hp-plus.o
@@ -73,42 +75,57 @@ endif
 
 ifdef CONFIG_PLIP
 NETDRV_OBJS := $(NETDRV_OBJS) plip.o
+else
+MODULES := $(MODULES) plip.o
+endif
 plip.o:        plip.c CONFIG
        $(CC) $(CPPFLAGS) $(CFLAGS) $(PLIP_OPTS) -c $<
-endif
 
 ifdef CONFIG_PPP
-NETDRV_OBJS := $(NETDRV_OBJS) ppp.o slhc.o
+NETDRV_OBJS := $(NETDRV_OBJS) ppp.o
+CONFIG_SLHC = CONFIG_SLHC
+else
+MODULES := $(MODULES) ppp.o
 endif
 
 ifdef CONFIG_SLIP
-NETDRV_OBJS := $(NETDRV_OBJS) slip.o slhc.o
+NETDRV_OBJS := $(NETDRV_OBJS) slip.o
+CONFIG_SLHC = CONFIG_SLHC
+else
+MODULES := $(MODULES) slip.o
+endif
 slip.o:        slip.c CONFIG
        $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
-endif
 
 ifdef CONFIG_DE650
 NETDRV_OBJS := $(NETDRV_OBJS) de650.o
 CONFIG_8390 = CONFIG_8390
 endif
+
 ifdef CONFIG_3C589
 NETDRV_OBJS := $(NETDRV_OBJS) 3c589.o
 endif
 
 ifdef CONFIG_DUMMY
 NETDRV_OBJS := $(NETDRV_OBJS) dummy.o
+else
+MODULES := $(MODULES) dummy.o
+endif
 dummy.o: dummy.c CONFIG
        $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
-endif
 
 ifdef CONFIG_DE600
 NETDRV_OBJS := $(NETDRV_OBJS) de600.o
+else
+MODULES := $(MODULES) de600.o
 endif
 de600.o: de600.c CONFIG
        $(CC) $(CPPFLAGS) $(CFLAGS) $(DE600_OPTS) -c $<
        
 ifdef CONFIG_DE620
 NETDRV_OBJS := $(NETDRV_OBJS) de620.o
+else
+MODULES := $(MODULES) de620.o
 endif
 de620.o: de620.c CONFIG
        $(CC) $(CPPFLAGS) $(CFLAGS) $(DE620_OPTS) -c $<
@@ -116,64 +133,88 @@ de620.o: de620.c CONFIG
 ifdef CONFIG_AT1500
 NETDRV_OBJS := $(NETDRV_OBJS) lance.o
 endif
+
 ifdef CONFIG_LANCE
 NETDRV_OBJS := $(NETDRV_OBJS) lance.o
 endif
+
 ifdef CONFIG_AT1700
 NETDRV_OBJS := $(NETDRV_OBJS) at1700.o
 endif
+
 ifdef CONFIG_EL1
 NETDRV_OBJS := $(NETDRV_OBJS) 3c501.o
+else
+MODULES := $(MODULES) 3c501.o
 endif
+
 ifdef CONFIG_EL16
 NETDRV_OBJS := $(NETDRV_OBJS) 3c507.o
 endif
+
 ifdef CONFIG_EL3
 NETDRV_OBJS := $(NETDRV_OBJS) 3c509.o
+else
+MODULES := $(MODULES) 3c509.o
 endif
+
 ifdef CONFIG_EEXPRESS
 NETDRV_OBJS := $(NETDRV_OBJS) eexpress.o
+else
+MODULES := $(MODULES) eexpress.o
 endif
+
 ifdef CONFIG_ZNET
 NETDRV_OBJS := $(NETDRV_OBJS) znet.o
 endif
+
 ifdef CONFIG_DEPCA
 NETDRV_OBJS := $(NETDRV_OBJS) depca.o
+else
+MODULES := $(MODULES) depca.o
+endif
 depca.o: depca.c CONFIG
        $(CC) $(CPPFLAGS) $(CFLAGS) $(DEPCA_OPTS) -c $<
-endif
+
 ifdef CONFIG_EWRK3
 NETDRV_OBJS := $(NETDRV_OBJS) ewrk3.o
+else
+MODULES := $(MODULES) ewrk3.o
+endif
 ewrk3.o: ewrk3.c CONFIG
        $(CC) $(CPPFLAGS) $(CFLAGS) $(EWRK3_OPTS) -c $<
-endif
+
 ifdef CONFIG_ATP
 NETDRV_OBJS := $(NETDRV_OBJS) atp.o
 endif
+
 ifdef CONFIG_NI52
 NETDRV_OBJS := $(NETDRV_OBJS) ni52.o
 endif
+
 ifdef CONFIG_NI65
 NETDRV_OBJS := $(NETDRV_OBJS) ni65.o
 endif
+
 ifdef CONFIG_ELPLUS
 NETDRV_OBJS := $(NETDRV_OBJS) 3c505.o
 endif
+
 ifdef CONFIG_AC3200
 NETDRV_OBJS := $(NETDRV_OBJS) ac3200.o
 CONFIG_8390 = CONFIG_8390
 endif
+
 ifdef CONFIG_APRICOT
 NETDRV_OBJS := $(NETDRV_OBJS) apricot.o
+else
+MODULES := $(MODULES) apricot.o
 endif
+
 ifdef CONFIG_DEC_ELCP
 NETDRV_OBJS := $(NETDRV_OBJS) tulip.o
 endif
 
-ifdef CONFIG_8390
-NETDRV_OBJS := $(NETDRV_OBJS) 8390.o
-endif
-
 ifdef CONFIG_ARCNET
 NETDRV_OBJS := $(NETDRV_OBJS) arcnet.o
 endif
@@ -181,8 +222,20 @@ endif
 ifdef CONFIG_PI
 NETDRV_OBJS := $(NETDRV_OBJS) pi2.o
 CONFIG_PI = CONFIG_PI
+endif
 pi2.o:  pi2.c CONFIG
        $(CC) $(CPPFLAGS) $(CFLAGS) $(PI_OPTS) -c $<
+
+ifdef CONFIG_SLHC
+NETDRV_OBJS := $(NETDRV_OBJS) slhc.o
+else
+MODULES := slhc.o $(MODULES)
+endif
+
+ifdef CONFIG_8390
+NETDRV_OBJS := $(NETDRV_OBJS) 8390.o
+else
+MODULES := 8390.o $(MODULES)
 endif
 
 net.a: $(NETDRV_OBJS)
@@ -193,7 +246,10 @@ clean:
        rm -f core *.o *.a *.s
 
 dep:
-       $(CPP) -M *.c > .depend
+       $(CPP) -M $(NETDRV_OBJS:.o=.c) > .depend
+ifdef MODULES
+       $(CPP) -M -DMODULE $(MODULES:.o=.c) >> .depend
+endif
 
 tar:
 
index a13e0fa1c0ef0a0bab6320dc95fdfae97b06ac8e..dc4bce9b515f5f67217500c8888e28504894993c 100644 (file)
 
 static char *version = "apricot.c:v0.2 05/12/94\n";
 
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/string.h>
@@ -37,11 +42,6 @@ static char *version = "apricot.c:v0.2 05/12/94\n";
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 
-#ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-#endif
-
 #ifndef HAVE_PORTRESERVE
 #define check_region(addr, size)       0
 #define request_region(addr, size,name)        do ; while(0)
index d7bd4d8530554dedf28660d793085fdc1808a67c..2ef5c136ad90821f5966fbbdd77232def7d03109 100644 (file)
@@ -90,6 +90,11 @@ static char *version =
 #endif
 unsigned int de600_debug = DE600_DEBUG;
 \f
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/types.h>
@@ -108,11 +113,6 @@ unsigned int de600_debug = DE600_DEBUG;
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 
-#ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-#endif
-
 #ifdef FAKE_SMALL_MAX
 static unsigned long de600_rspace(struct sock *sk);
 #include "../../net/inet/sock.h"
index 81a2b675f1fbcf6507ac06dfc3ba900809811049..1ca83c34714fe84168dd2d51e5fea6f1c5569117 100644 (file)
@@ -108,6 +108,11 @@ static int bnc, utp;
  *     insmod de620.o utp=1
  */
 \f
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/types.h>
@@ -126,11 +131,6 @@ static int bnc, utp;
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 
-#ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-#endif
-
 /* Constant definitions for the DE-620 registers, commands and bits */
 #include "de620.h"
 
index a0082ce881eb6e8a8655d9f3075c45dd079325ba..e8da2a21c2c612b91ac82327d076ef9ea605d777 100644 (file)
 
 static char *version = "depca.c:v0.381 12/12/94 davies@wanton.lkg.dec.com\n";
 
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif /* MODULE */
+
 #include <stdarg.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -193,11 +198,6 @@ static char *version = "depca.c:v0.381 12/12/94 davies@wanton.lkg.dec.com\n";
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 
-#ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-#endif /* MODULE */
-
 #include "depca.h"
 
 #ifdef DEPCA_DEBUG
index 587fd8e744fee9d25358830483a44f83673776f3..24c4102970aa84ef94a3cda3454e8459dfb97535 100644 (file)
 /* To have statistics (just packets sent) define this */
 #undef DUMMY_STATS
 
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/types.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 
-#ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-#endif
-
 static int dummy_xmit(struct sk_buff *skb, struct device *dev);
 #ifdef DUMMY_STATS
 static struct enet_statistics *dummy_get_stats(struct device *dev);
index fe65b689b8475a6d593bd53c526acc1db24d29dc..d9340ef62d400db5fd5dc395161dc19d1ba5e562 100644 (file)
@@ -38,6 +38,11 @@ static char *version =
        info that the casual reader might think that it documents the i82586.
 */
 
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/types.h>
@@ -56,11 +61,6 @@ static char *version =
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
-#ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-#endif
-
 #include <linux/malloc.h>
 
 /* use 0 for production, 1 for verification, 2..7 for debug */
index d6cbb85a70ef8b8c7424b0b0fc672a398b898173..9a0fb905b6d1fde202424868937ce452dff5dc3a 100644 (file)
 
 static char *version = "ewrk3.c:v0.32 1/16/95 davies@wanton.lkg.dec.com\n";
 
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif /* MODULE */
+
 #include <stdarg.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -150,11 +155,6 @@ static char *version = "ewrk3.c:v0.32 1/16/95 davies@wanton.lkg.dec.com\n";
 #include <linux/types.h>
 #include <linux/unistd.h>
 
-#ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-#endif /* MODULE */
-
 #include "ewrk3.h"
 
 #ifdef EWRK3_DEBUG
index af7f70e82a44512ea3b7ad812e58b02a3be38943..f0afb87dfef1765783ba7e2caa1f537e7b90d1bb 100644 (file)
@@ -1,6 +1,6 @@
 /* netdrv_init.c: Initialization for network devices. */
 /*
-       Written 1993,1994 by Donald Becker.
+       Written 1993,1994,1995 by Donald Becker.
 
        The author may be reached as becker@cesdis.gsfc.nasa.gov or
        C/O Center of Excellence in Space Data and Information Sciences
@@ -108,11 +108,13 @@ init_etherdev(struct device *dev, int sizeof_priv, unsigned long *mem_startp)
                                        if (strcmp(pname, cur_dev->name) == 0) {
                                                dev = cur_dev;
                                                dev->init = NULL;
+                                               sizeof_priv = (sizeof_priv + 3) & ~3;
                                                if (mem_startp && *mem_startp ) {
                                                        dev->priv = (void*) *mem_startp;
-                                                       *mem_startp += sizeof_priv + 3;
+                                                       *mem_startp += sizeof_priv;
                                                } else
-                                                       dev->priv = kmalloc(sizeof_priv + 3, GFP_KERNEL);
+                                                       dev->priv = kmalloc(sizeof_priv, GFP_KERNEL);
+                                               memset(dev->priv, 0, sizeof_priv);
                                                goto found;
                                        }
                        }
index 3fb2d81a9a36c0e60157e00a943efbfb0285a5c0..efc0ee37eb37a81222c31cda7fb84b70fa3db592 100644 (file)
@@ -64,6 +64,11 @@ make one yourself.  The wiring is:
     extra grounds are 18,19,20,21,22,23,24
 */
 
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/types.h>
@@ -89,11 +94,6 @@ make one yourself.  The wiring is:
 #include <asm/bitops.h>
 #include <asm/irq.h>
 
-#ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-#endif
-
 /* use 0 for production, 1 for verification, >2 for debug */
 #ifndef NET_DEBUG
 #define NET_DEBUG 3
index bca7e16da8690f6a3ded7363e7e05a918664a80c..c0b2ba6015ee3adf112130f04bb4f893de255e1a 100644 (file)
@@ -40,6 +40,8 @@
  *                     Fixes for memory leaks.
  *      - Oct 1994      Dmitry Gorodchanin
  *                      Modularization.
+ *     - Jan 1995      Bjorn Ekwall
+ *                     Use ip_fast_csum from ip.h
  *
  *
  *     This module is a difficult issue. Its clearly inet code but its also clearly
 #include <linux/config.h>
 #ifdef CONFIG_INET
 /* Entire module is for IP only */
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
+
 #include <linux/types.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/mm.h>
 #include "slhc.h"
 
-#ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-#endif
-
 int last_retran;
 
 static unsigned char *encode(unsigned char *cp, unsigned short n);
@@ -85,9 +87,6 @@ static long decode(unsigned char **cpp);
 static unsigned char * put16(unsigned char *cp, unsigned short x);
 static unsigned short pull16(unsigned char **cpp);
 
-extern int ip_csum(struct iphdr *iph);
-
-
 /* Initialize compression data structure
  *     slots must be in range 0 to 255 (zero meaning no compression)
  */
@@ -619,7 +618,7 @@ slhc_uncompress(struct slcompress *comp, unsigned char *icp, int isize)
          cp += ((ip->ihl) - 5) * 4;
        }
 
-       ((struct iphdr *)icp)->check = ip_csum((struct iphdr*)icp);
+       ((struct iphdr *)icp)->check = ip_fast_csum(icp, ((struct iphdr*)icp)->ihl);
 
        memcpy(cp, thp, 20);
        cp += 20;
@@ -662,7 +661,7 @@ slhc_remember(struct slcompress *comp, unsigned char *icp, int isize)
        icp[9] = IPPROTO_TCP;
        ip = (struct iphdr *) icp;
 
-       if (ip_csum(ip)) {
+       if (ip_fast_csum(icp, ip->ihl)) {
                /* Bad IP header checksum; discard */
                comp->sls_i_badcheck++;
                return slhc_toss( comp );
index ac01db0dcadb470ddc2217126a36dc22f3b48147..ea20e0332df9e0b7273ad60b3a256474f6457f38 100644 (file)
 
 #define SL_CHECK_TRANSMIT
 #include <linux/config.h>
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#endif
 
 /* Undef this, if you don't need 6bit encapsulation code in the driver */
 #define CONFIG_SLIP_MODE_SLIP6
 #include "tcp.h"
 #include "slhc.h"
 #endif
-#ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-#endif
-
 
 #ifdef MODULE
 #define SLIP_VERSION    "0.8.3-NET3.019-NEWTTY-MODULAR"
index add32d6465e642dd1e6157cff4c066cc372c7a4f..a0cdd8b1093c3d6952ade916480f2aa8aadb36f6 100644 (file)
@@ -14,7 +14,7 @@
           Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771
 */
 
-static char *version = "tulip.c:v0.03 1/18/95 becker@cesdis.gsfc.nasa.gov\n";
+static char *version = "tulip.c:v0.05 1/20/95 becker@cesdis.gsfc.nasa.gov\n";
 
 #include <linux/config.h>
 #include <linux/kernel.h>
@@ -48,7 +48,7 @@ struct netdev_entry tulip_drv =
 {"Tulip", tulip_pci_probe, TULIP_TOTAL_SIZE, NULL};
 #endif
 
-#define TULIP_DEBUG 3
+#define TULIP_DEBUG 1
 #ifdef TULIP_DEBUG
 int tulip_debug = TULIP_DEBUG;
 #else
@@ -177,7 +177,6 @@ unsigned long dec21040_init(unsigned long mem_start, unsigned long mem_end)
 
     if (pcibios_present()) {
            int pci_index;
-               printk("tulip.c: PCI bios is present, checking for devices...\n");
                for (pci_index = 0; pci_index < 8; pci_index++) {
                        unsigned char pci_bus, pci_device_fn, pci_irq_line;
                        unsigned long pci_ioaddr;
@@ -217,6 +216,11 @@ unsigned long tulip_probe1(unsigned long mem_start, int ioaddr, int irq)
 
        printk("%s: DEC 21040 Tulip at %#3x,", dev->name, ioaddr);
 
+       /* Stop the chip's Tx and Rx processes. */
+       outl(inl(ioaddr + CSR6) & ~0x2002, ioaddr + CSR6);
+       /* Clear the missed-packet counter. */
+       inl(ioaddr + CSR8) & 0xffff;
+
        /* The station address ROM is read byte serially.  The register must
           be polled, waiting for the value to be read bit serially from the
           EEPROM.
@@ -229,6 +233,7 @@ unsigned long tulip_probe1(unsigned long mem_start, int ioaddr, int irq)
                while (value < 0  && --boguscnt > 0);
                printk(" %2.2x", dev->dev_addr[i] = value);
        }
+       printk(", IRQ %d\n", irq);
 
        /* We do a request_region() only to register /proc/ioports info. */
        request_region(ioaddr, TULIP_TOTAL_SIZE, "DEC Tulip Ethernet");
@@ -241,8 +246,6 @@ unsigned long tulip_probe1(unsigned long mem_start, int ioaddr, int irq)
        tp = (struct tulip_private *)dev->priv;
        tp->rx_buffs = (long)dev->priv + sizeof(struct tulip_private);
 
-       printk(", Rx buffers at %#x, IRQ %d\n", tp->rx_buffs, dev->irq);
-
        /* The Tulip-specific entries in the device structure. */
        dev->open = &tulip_open;
        dev->hard_start_xmit = &tulip_start_xmit;
@@ -268,9 +271,15 @@ tulip_open(struct device *dev)
        /* Reset the chip, holding bit 0 set at least 10 PCI cycles. */
        outl(0xfff80001, ioaddr + CSR0);
        SLOW_DOWN_IO;
-       /* Deassert reset.  Wait the specified 50 PCI cycles by initializing
+       /* Deassert reset.  Set 8 longword cache alignment, 8 longword burst.
+          Cache alignment bits 15:14        Burst length 13:8
+       0000    No alignment  0x00000000 unlimited              0800 8 longwords
+               4000    8  longwords            0100 1 longword         1000 16 longwords
+               8000    16 longwords            0200 2 longwords        2000 32 longwords
+               C000    32  longwords           0400 4 longwords
+          Wait the specified 50 PCI cycles after a reset by initializing
           Tx and Rx queues and the address filter list. */
-       outl(0xfff80000, ioaddr + CSR0);
+       outl(0xfff84800, ioaddr + CSR0);
 
        if (irq2dev_map[dev->irq] != NULL
                || (irq2dev_map[dev->irq] = dev) == NULL
@@ -280,8 +289,7 @@ tulip_open(struct device *dev)
        }
 
        if (tulip_debug > 1)
-               printk("%s: tulip_open() irq %d.\n",
-                          dev->name, dev->irq);
+               printk("%s: tulip_open() irq %d.\n", dev->name, dev->irq);
 
        tulip_init_ring(dev);
 
@@ -611,11 +619,6 @@ tulip_rx(struct device *dev)
                        skb->len = pkt_len;
                        skb->dev = dev;
                        memcpy(skb->data, lp->rx_ring[entry].buffer1, pkt_len);
-                       printk("%s: New packet length %d status %#x %#x %#x %#x to %#x.\n",
-                                  dev->name, pkt_len, lp->rx_ring[entry].status,
-                                  lp->rx_ring[entry].length, lp->rx_ring[entry].buffer1,
-                                  lp->rx_ring[entry].buffer2,
-                                  lp->rx_ring[entry].buffer1);
                        netif_rx(skb);
                        lp->stats.rx_packets++;
                }
index 27b495fa22c13062b4eeed9804f66cb55769d72d..4895b56203767981f7c65b207acfe5e11c5a615e 100644 (file)
 #include <linux/bios32.h>
 #include <linux/pci.h>
 #include <linux/string.h>
+#include <linux/mm.h>
 #include "../block/blk.h"
 #include "scsi.h"
 #include "hosts.h"
index bd306a14ceccfb17088d404ff024fcfaae12cbaa..6532842df05b2004d987cfcd16a0b984210c4e8a 100644 (file)
@@ -64,8 +64,8 @@ SCSI_OBJS := $(SCSI_OBJS) aha152x.o
 SCSI_SRCS := $(SCSI_SRCS) aha152x.c
 endif
 
-SCSI_SRCS := $(SCSI_SRCS) aha1542.c
 ifdef CONFIG_SCSI_AHA1542
+SCSI_SRCS := $(SCSI_SRCS) aha1542.c
 SCSI_OBJS := $(SCSI_OBJS) aha1542.o
 else
 SCSI_MODULE_OBJS := $(SCSI_MODULE_OBJS) aha1542.o
@@ -96,8 +96,8 @@ SCSI_OBJS := $(SCSI_OBJS) u14-34f.o
 SCSI_SRCS := $(SCSI_SRCS) u14-34f.c
 endif
 
-SCSI_SRCS := $(SCSI_SRCS) scsi_debug.c
 ifdef CONFIG_SCSI_DEBUG
+SCSI_SRCS := $(SCSI_SRCS) scsi_debug.c
 SCSI_OBJS := $(SCSI_OBJS) scsi_debug.o
 else
 SCSI_MODULE_OBJS := $(SCSI_MODULE_OBJS) scsi_debug.o
@@ -108,8 +108,8 @@ SCSI_OBJS := $(SCSI_OBJS) fdomain.o
 SCSI_SRCS := $(SCSI_SRCS) fdomain.c
 endif
 
-SCSI_SRCS := $(SCSI_SRCS) in2000.c
 ifdef CONFIG_SCSI_IN2000
+SCSI_SRCS := $(SCSI_SRCS) in2000.c
 SCSI_OBJS := $(SCSI_OBJS) in2000.o
 else
 SCSI_MODULE_OBJS := $(SCSI_MODULE_OBJS) in2000.o
@@ -195,6 +195,7 @@ modules: $(SCSI_MODULE_OBJS)
 
 dep:
        $(CPP) -M $(AHA152X) $(SCSI_SRCS) > .depend
+       $(CPP) -M -DMODULE $(SCSI_MODULE_OBJS:.o=.c) >> .depend
 
 else
 
index 3a17f32ca2d830999988dece5d7744351ed7a988..5b7b045f99df5431b74b4ea3bab1b7a024cfb875 100644 (file)
  *        Accept parameters from LILO cmd-line. -- 1-Oct-94
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/kernel.h>
 #include <linux/head.h>
 #include <linux/types.h>
index 72b484af496f3b64bd795e6b657f90ab49246c2f..a23520dc841a2c43e2ff98d585c0382868e82714 100644 (file)
  *    unfinished, questionable, or wrong.
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/string.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
index 4a150270459d4ba0375e9f730e83949681686f4d..7b3732196f58b6abd020c773c6b57a80fc725c17 100644 (file)
@@ -20,6 +20,8 @@
 #include "../block/blk.h"
 #include <linux/kernel.h>
 #include <linux/string.h>
+#include <linux/mm.h>
+
 #include "scsi.h"
 
 #ifndef NULL
index 5fc57ba5483d84b3282aa8461dadb1a048e2dc16..b5ab6835cc1cdd570ad8da8ec15c3e7b8d8f61ee 100644 (file)
 
 /*----------------------------------------------------------------*/
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include "../block/blk.h"      /* to get disk capacity */
 #include <linux/kernel.h>
 #include <linux/string.h>
index 1ea7bf4b2fe927cd86e2f41711f620e823192fbb..0619340aff4673f9982621c04836a1669f3d2842 100644 (file)
@@ -5,6 +5,7 @@
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
+#include <linux/mm.h>
 #include <linux/string.h>
 
 #include "../block/blk.h"
index d87a1aa0b5abccd9ba60e4e63a880339e51d7116..2d581e6794c11878211abfb825940dfccf0115c5 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/fs.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
+#include <linux/mm.h>
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <asm/system.h>
index 599a2a320b848580d673c0a950c303933958dca7..8c18d08430fa82406b273be0347ddf6a6fb0de07 100644 (file)
@@ -1,5 +1,6 @@
 #include <linux/kernel.h>
 #include <linux/sched.h>
+#include <linux/mm.h>
 #include <linux/fs.h>
 #include <linux/hdreg.h>
 #include <linux/errno.h>
index 5cdb2e410d9f3b5f7f249583c8ce4125562f6979..159473fdd2e4603f42c2df3efd8e869346cf0830 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/string.h>
+#include <linux/mm.h>
 #include <linux/errno.h>
 #include <linux/mtio.h>
 #include <linux/ioctl.h>
index b6ae3fcdb4410af07a16ceaf556f27c2040b1ff5..037a6f9d1f6b30c9d3a60989b21228f5774ae9ba 100644 (file)
@@ -1,5 +1,6 @@
 #include <linux/kernel.h>
 #include <linux/sched.h>
+#include <linux/mm.h>
 #include <linux/fs.h>
 #include <asm/segment.h>
 #include <linux/errno.h>
index 6061559b8bbd542f1bbc87f1a12bf58767510268..7420c29d3bc7941993786528ce2dea5a2b415a0c 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/fs.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
+#include <linux/mm.h>
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/mtio.h>
index 9b9ecddea1fd37c1f6fc599ca25a9f3900733321..ab90bf5da52678cccb0d68ff19bf8b1538bf2351 100644 (file)
@@ -32,6 +32,7 @@
 #ifdef CONFIGURE_SOUNDCARD
 
 #include <linux/major.h>
+#include <linux/mm.h>
 
 static int      soundcards_installed = 0;      /* Number of installed
 
index e0c84b8a9293138c4d54d7c724a0148624771de4..77773ca019c3fc13796b157d13b59dcf37dc4d98 100644 (file)
@@ -98,12 +98,15 @@ filesystems.a: dummy
 modules: $(MODULE_OBJS)
        for i in $(MODULE_FS_SUBDIRS); do $(MAKE) -C $$i modules; done
        cd ../modules;for i in $(MODULE_OBJS); do ln -sf ../fs/$$i .; done
-       cd ../modules;for i in $(MODULE_FS_SUBDIRS); do ln -sf ../fs/$$i/$$i.o .; done
+       cd ../modules;for i in $(MODULE_FS_SUBDIRS); \
+       do echo $$i.o; ln -sf ../fs/$$i/$$i.o .; done > ../modules/FS_MODULES
 
 depend dep:
        $(CPP) -M *.c > .depend
-       set -e; for i in $(SUBDIRS); do \
+       set -e; for i in $(FS_SUBDIRS); do \
          test ! -d $$i || $(MAKE) -C $$i dep; done
+       set -e; for i in $(MODULE_FS_SUBDIRS); do \
+         test ! -d $$i || $(MAKE) -C $$i CFLAGS="$(CFLAGS) -DMODULE" dep; done
 
 dummy:
 
index d19af6fa0cd0353661a14e3ae8bb93f6c249b8d1..9d54d03c7d7d782ef5d033e6582e13261a6f163d 100644 (file)
@@ -9,12 +9,15 @@
 #include <linux/kernel.h>
 #include <linux/locks.h>
 #include <linux/fcntl.h>
+#include <linux/mm.h>
+
 #include <asm/segment.h>
 #include <asm/system.h>
 
 extern int *blk_size[];
 extern int *blksize_size[];
 
+#define MAX_BUF_PER_PAGE (PAGE_SIZE / 512)
 #define NBUF 64
 
 int block_write(struct inode * inode, struct file * filp, char * buf, int count)
@@ -24,7 +27,7 @@ int block_write(struct inode * inode, struct file * filp, char * buf, int count)
        loff_t offset;
        int chars;
        int written = 0;
-       int cluster_list[8];
+       int cluster_list[MAX_BUF_PER_PAGE];
        struct buffer_head * bhlist[NBUF];
        int blocks_per_cluster;
        unsigned int size;
@@ -162,7 +165,7 @@ int block_read(struct inode * inode, struct file * filp, char * buf, int count)
        int blocksize_bits, i;
        unsigned int blocks, rblocks, left;
        int bhrequest, uptodate;
-       int cluster_list[8];
+       int cluster_list[MAX_BUF_PER_PAGE];
        int blocks_per_cluster;
        struct buffer_head ** bhb, ** bhe;
        struct buffer_head * buflist[NBUF];
index c4eaeb5f9a28627dd9a56d4a6d610926f19e0e83..318f6791135ad5c60725d7e14d70f4214e1814be 100644 (file)
@@ -33,6 +33,7 @@ static char buffersize_index[9] = {-1,  0,  1, -1,  2, -1, -1, -1, 3};
 static short int bufferindex_size[NR_SIZES] = {512, 1024, 2048, 4096};
 
 #define BUFSIZE_INDEX(X) ((int) buffersize_index[(X)>>9])
+#define MAX_BUF_PER_PAGE (PAGE_SIZE / 512)
 
 static int grow_buffers(int pri, int size);
 static int shrink_specific_buffers(unsigned int priority, int size);
@@ -258,14 +259,16 @@ void invalidate_buffers(dev_t dev)
 
        for(nlist = 0; nlist < NR_LIST; nlist++) {
                bh = lru_list[nlist];
-               for (i = nr_buffers_type[nlist]*2 ; --i > 0 ; 
-                    bh = bh->b_next_free) {
+               for (i = nr_buffers_type[nlist]*2 ; --i > 0 ; bh = bh->b_next_free) {
                        if (bh->b_dev != dev)
-                                continue;
+                               continue;
                        wait_on_buffer(bh);
-                       if (bh->b_dev == dev)
-                                bh->b_flushtime = bh->b_uptodate = 
-                                         bh->b_dirt = bh->b_req = 0;
+                       if (bh->b_dev != dev)
+                               continue;
+                       if (bh->b_count)
+                               continue;
+                       bh->b_flushtime = bh->b_uptodate = 
+                               bh->b_dirt = bh->b_req = 0;
                }
        }
 }
@@ -962,7 +965,7 @@ static void read_buffers(struct buffer_head * bh[], int nrbuf)
 {
        int i;
        int bhnum = 0;
-       struct buffer_head * bhr[8];
+       struct buffer_head * bhr[MAX_BUF_PER_PAGE];
 
        for (i = 0 ; i < nrbuf ; i++) {
                if (bh[i] && !bh[i]->b_uptodate)
@@ -996,7 +999,7 @@ static unsigned long try_to_align(struct buffer_head ** bh, int nrbuf,
 static unsigned long check_aligned(struct buffer_head * first, unsigned long address,
        dev_t dev, int *b, int size)
 {
-       struct buffer_head * bh[8];
+       struct buffer_head * bh[MAX_BUF_PER_PAGE];
        unsigned long page;
        unsigned long offset;
        int block;
@@ -1037,7 +1040,7 @@ no_go:
 static unsigned long try_to_load_aligned(unsigned long address,
        dev_t dev, int b[], int size)
 {
-       struct buffer_head * bh, * tmp, * arr[8];
+       struct buffer_head * bh, * tmp, * arr[MAX_BUF_PER_PAGE];
        unsigned long offset;
         int isize = BUFSIZE_INDEX(size);
        int * p;
@@ -1128,7 +1131,7 @@ static inline unsigned long try_to_share_buffers(unsigned long address,
  */
 unsigned long bread_page(unsigned long address, dev_t dev, int b[], int size, int no_share)
 {
-       struct buffer_head * bh[8];
+       struct buffer_head * bh[MAX_BUF_PER_PAGE];
        unsigned long where;
        int i, j;
 
@@ -1518,7 +1521,7 @@ static int reassign_cluster(dev_t dev,
  */
 static unsigned long try_to_generate_cluster(dev_t dev, int block, int size)
 {
-       struct buffer_head * bh, * tmp, * arr[8];
+       struct buffer_head * bh, * tmp, * arr[MAX_BUF_PER_PAGE];
         int isize = BUFSIZE_INDEX(size);
        unsigned long offset;
        unsigned long page;
index 68c24455a601fef2f315bfa69b2cb2cbef35550b..193301924521eaabe25d75bd0c46ef8a4f65089b 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/stat.h>
 #include <linux/string.h>
 #include <linux/locks.h>
+#include <linux/mm.h>
 
 void ext2_put_inode (struct inode * inode)
 {
index 447968ef074a6bb574434ecdbab273c81b3e06f9..3c42c56269661b6ecbdfbd43943a1d6f8b88e3db 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/ext2_fs.h>
 #include <linux/ioctl.h>
 #include <linux/sched.h>
+#include <linux/mm.h>
 
 int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
                unsigned long arg)
index ecd9bc232e18c56a008514ed5f83b2498a8a3cfd..e9753534abaa806d597e50758a38114c89ca3e4c 100644 (file)
--- a/fs/fifo.c
+++ b/fs/fifo.c
@@ -8,6 +8,7 @@
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/fcntl.h>
+#include <linux/mm.h>
 
 static int fifo_open(struct inode * inode,struct file * filp)
 {
index 22d0f4d1044d4f0d72c756b7efe692a62c62f611..6cb02a54775d6ade9bb0feea6bf2e81aecfe0a49 100644 (file)
@@ -7,6 +7,7 @@
 #include <asm/segment.h>
 
 #include <linux/sched.h>
+#include <linux/mm.h>
 #include <linux/errno.h>
 #include <linux/string.h>
 #include <linux/stat.h>
index b1934db044ce40be77965d041f4064663440499d..1b8bdbc1d4668dfaeadc8a515e9bc9803e1f70a2 100644 (file)
@@ -8,6 +8,10 @@
  *  isofs directory handling functions
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/errno.h>
 
 #include <asm/segment.h>
index ee0877d7b509c95e5c67064ad609686b15622fc7..831bfeaf4d3406e6082fd136b50f719d79480c6f 100644 (file)
@@ -8,6 +8,10 @@
  *  isofs regular file handling primitives
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 #include <asm/system.h>
 
index 5e5d8292e6fe1f53ce01f90f9873a148dce9b8e4..d0dfa718d0e7658c60931d58f6919e9ea4d89c63 100644 (file)
@@ -6,6 +6,14 @@
  *  (C) 1991  Linus Torvalds - minix filesystem
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#else
+#define MOD_INC_USE_COUNT
+#define MOD_DEC_USE_COUNT
+#endif
+
 #include <linux/stat.h>
 #include <linux/sched.h>
 #include <linux/iso_fs.h>
 #include <asm/system.h>
 #include <asm/segment.h>
 
-#ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
-
 #ifdef LEAK_CHECK
 static int check_malloc = 0;
 static int check_bread = 0;
index 1473b1b7f4a52d3bc6bd505ab5c8857b57933b8d..42fb69fe6bf64d5685d680249f0e9126d8b62250 100644 (file)
@@ -6,6 +6,10 @@
  *  (C) 1991  Linus Torvalds - minix filesystem
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/sched.h>
 #include <linux/iso_fs.h>
 #include <linux/kernel.h>
index f7737adf1fc6a87ed5071cc613eaad836baa3618..f9d1e483a90a139ec315d00802e32bcd6be43deb 100644 (file)
@@ -5,6 +5,10 @@
  *
  *  Rock Ridge Extensions to iso9660
  */
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/stat.h>
 #include <linux/sched.h>
 #include <linux/iso_fs.h>
index fa4a45ba614a5af85508bb8d0de1f705c5d165c2..d159e424fe640e434c3301ac003e311201b5cdbb 100644 (file)
@@ -9,6 +9,10 @@
  *  extensions to iso9660
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 
 #include <linux/errno.h>
index dbeee868d20b98f2e61797309a9507166afeb419..ba432b39165a7734ca5d5d2bc37aa4a47c43369e 100644 (file)
@@ -9,6 +9,10 @@
  * the bsd386 iso9660 filesystem, by Pace Williamson.
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 
 int
 isonum_711 (char * p)
index d42b86eea819e729c2f2f471c4acca3858d2a29d..ac97cb84e0bb6a119f4285d4f927f5947d3c0f4b 100644 (file)
@@ -6,6 +6,10 @@
 
 /* bitmap.c contains the code that handles the inode and block bitmaps */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/sched.h>
 #include <linux/minix_fs.h>
 #include <linux/stat.h>
index 6ece61971733fbc50230b84c1cb846c1d070ec90..82c265c3c5990a5e5a1c2cdcce4ffcf75ed45df9 100644 (file)
@@ -6,6 +6,10 @@
  *  minix directory handling functions
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 
 #include <linux/errno.h>
index 670fb5e751586513a30bf270de8e006b7628964d..db3097c37c061baa31e69cf14439255b91742fe5 100644 (file)
@@ -6,6 +6,10 @@
  *  minix regular file handling primitives
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 #include <asm/system.h>
 
index 737a5bfcd18459bd1149c3e66e3e3d043ea18e15..436d27191ab597b91a0a088561b54188da5dca97 100644 (file)
@@ -8,6 +8,10 @@
  *  minix fsync primitive
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 #include <asm/system.h>
 
index 771ceec562938fed4d9c9edf4fd7bfa72bb28ec6..995008c92d6324646bfed235b135e40cd960faa5 100644 (file)
@@ -4,6 +4,10 @@
  *  Copyright (C) 1991, 1992  Linus Torvalds
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/sched.h>
 #include <linux/minix_fs.h>
 #include <linux/kernel.h>
index bbd2b1f56fb82c82f767a1625c4560b4ca3586fc..86dabf9363e5ea0f22b384ee9281913471fe7d47 100644 (file)
@@ -6,6 +6,10 @@
  *  minix symlink handling code
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 
 #include <linux/errno.h>
index 0b127b9b840f5c90dd4297005eeccad845151a93..503c7caabdd00cd543d16379913c8cd0227e2695 100644 (file)
@@ -4,6 +4,10 @@
  *  Copyright (C) 1991, 1992  Linus Torvalds
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/minix_fs.h>
index 51c7456d9cc8b59bcc5e0d41810aaa3d758e6506..13e7aaeb6c484803caedda33a228e01e975ec971 100644 (file)
@@ -1,3 +1,7 @@
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/mm.h>
 #include <linux/malloc.h>
 #include <linux/string.h>
index 77bd05c224d48b7f50fb891cd89f9d52f8e151a6..a94b532b96e4fbd018bbc737a1673e54f9c75198 100644 (file)
@@ -6,6 +6,10 @@
  *  MS-DOS directory handling functions
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 
 #include <linux/fs.h>
index 0e4526599aa54532e434ef78cc73733bae08ff38..6059ec7bcfbe7a6aa74660a0f8aa466c51a2e4ab 100644 (file)
@@ -4,6 +4,10 @@
  *  Written 1992,1993 by Werner Almesberger
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/msdos_fs.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
index 0580b83e7429ea6f149aa178dec04f59a4df3953..491084a71b979c70312ee12815cf34922143abc7 100644 (file)
@@ -6,6 +6,10 @@
  *  MS-DOS regular file handling primitives
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 #include <asm/system.h>
 
index 7fb9f99bd861ce13555cf0b733e4005c6e12f24a..e6d891312183c2fc3068f7d92ff4f725cd88a3c9 100644 (file)
@@ -4,6 +4,14 @@
  *  Written 1992,1993 by Werner Almesberger
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#else
+#define MOD_INC_USE_COUNT
+#define MOD_DEC_USE_COUNT
+#endif
+
 #include <linux/msdos_fs.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 
 #include "msbuffer.h"
 
-#ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
-
 #include <asm/segment.h>
 
 extern int *blksize_size[];
index 79ccbe23bccd3038d95f31e692a91ce69160494a..365823d029bb2ecea907972f86e02294c2d98f6c 100644 (file)
@@ -4,6 +4,10 @@
  *  Written 1992,1993 by Werner Almesberger
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/fs.h>
 #include <linux/msdos_fs.h>
 #include <linux/sched.h>
index b22d58265c36dd8f6ba0bcaa5395da7441e5eb05..97ffa0bb1ab617e915885bc307a32a5a461a862d 100644 (file)
@@ -6,6 +6,10 @@
  *
  *     msdos mmap handling
  */
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/stat.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
index 0ce78f1e4fd907f16c2185e34cbce69d1edb0be9..ee7a14e36b165f1446246aaa6bf420308e564707 100644 (file)
@@ -4,6 +4,10 @@
  *  Written 1992,1993 by Werner Almesberger
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 
 #include <linux/sched.h>
index 62a3e082179b709408ccb03070759fdbb899e8f7..1a19e8a731eabee3744f2a58396ae7d8c801120a 100644 (file)
@@ -6,6 +6,10 @@
  *  nfs directory handling functions
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/sched.h>
 #include <linux/errno.h>
 #include <linux/stat.h>
index e71d2948342ab3de83bbb0367db88a7c4939f20a..584a10d3298ec8824e0e546ea83ec623e7493911 100644 (file)
  *  nfs regular file handling functions
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 #include <asm/system.h>
 
index 747a9003e81ee38cda73ed6691ee80a3b5be3e3a..35dd432ed694b28c5293713afe28b0bda37204b7 100644 (file)
@@ -9,9 +9,6 @@
  *  experimental NFS changes. Modularisation taken straight from SYS5 fs.
  */
 
-#include <asm/system.h>
-#include <asm/segment.h>
-
 #ifdef MODULE
 #include <linux/module.h>
 #include <linux/version.h>
@@ -20,6 +17,9 @@
 #define MOD_DEC_USE_COUNT
 #endif
 
+#include <asm/system.h>
+#include <asm/segment.h>
+
 #include <linux/sched.h>
 #include <linux/nfs_fs.h>
 #include <linux/kernel.h>
index 3e1380741b52a944f7ad6dff404b4c42b30d7077..30854469c3ec4719a48ebeaaa75556ee702f56fa 100644 (file)
@@ -9,6 +9,10 @@
  *     Copyright (C) 1993
  *
  */
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/stat.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
index 406f5743e1b5ec87620ddbbb82b03b1b1058a2a5..e4a7beefe53002b04bafb64e5b4cde0588459c55 100644 (file)
 #define NFS_PROC_DEBUG
 #endif
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/param.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
index 321d2e06b219495372fc107dff517f293a73675e..45e027cbb7f1d7b1ad8ea7c05ea2df1f3ade99c6 100644 (file)
  *
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/sched.h>
 #include <linux/nfs_fs.h>
 #include <linux/errno.h>
index 4cbe631c630a0ccff15d896d237aa22cb1dd33f0..85c40b495143b4c04a38ff5e43e92bb3ca998bc2 100644 (file)
@@ -8,6 +8,10 @@
  *  nfs symlink handling code
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 
 #include <linux/sched.h>
index 56e4980e64ba25269f03e391dd3af321272f3c49..713a5ef1edc971571a91677716d90e77068a63fb 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -16,6 +16,7 @@
 #include <linux/signal.h>
 #include <linux/tty.h>
 #include <linux/time.h>
+#include <linux/mm.h>
 
 #include <asm/segment.h>
 
index bc557888efe384364b9b22b0508fb9adb7ec19ff..4a58fbffed539b275c3abed86bdc3f948be057c2 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -12,6 +12,7 @@
 #include <linux/signal.h>
 #include <linux/fcntl.h>
 #include <linux/termios.h>
+#include <linux/mm.h>
 
 
 /* We don't use the head/tail construction any more. Now we use the start/len*/
index f2516ce2c00c1a5abbce6e60d1d1a50a0c4dbacf..640cfeaee5a2129f42f1b2052188f70bdbe19904 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/ioport.h>
 #include <linux/config.h>
 #include <linux/delay.h>
+#include <linux/mm.h>
 
 #include <asm/segment.h>
 #include <asm/io.h>
@@ -627,7 +628,7 @@ static int read_maps (int pid, struct file * file, char * buf, int count)
                *cp++ = flags & VM_READ ? 'r' : '-';
                *cp++ = flags & VM_WRITE ? 'w' : '-';
                *cp++ = flags & VM_EXEC ? 'x' : '-';
-               *cp++ = flags & VM_SHARED ? 's' : 'p';
+               *cp++ = flags & VM_MAYSHARE ? 's' : 'p';
                *cp++ = 0;
 
                if (map->vm_inode != NULL) {
index 89e59677e965212672db4bfde7b0ecf7bdf68ccb..79d07cb77dd56fae617da22a29917bc6b39ced2c 100644 (file)
@@ -202,6 +202,9 @@ void proc_read_inode(struct inode * inode)
                        inode->i_nlink = 2;
                        return;
                case PROC_PID_ENVIRON:
+                       inode->i_mode = S_IFREG | S_IRUSR;
+                       inode->i_op = &proc_array_inode_operations;
+                       return;
                case PROC_PID_CMDLINE:
                case PROC_PID_STAT:
                case PROC_PID_STATM:
index f611b1e509308353d557f6e802c78d706b6ada14..2f940a275fb946420198efdaff72d0bd2d78a00d 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/fs.h>
+#include <linux/mm.h>
 #include <linux/proc_fs.h>
 #include <linux/stat.h>
 
index 02604cb3dd157a0b3096f676f5ec6eef70c00d3f..f9137d3a056b098e83843458109f0ca5d9d50570 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/proc_fs.h>
 #include <linux/stat.h>
 #include <linux/config.h>
+#include <linux/mm.h>
 
 /* forward references */
 static int proc_readnet(struct inode * inode, struct file * file,
index 5f457b9cb61f799d7e0a8c67cfc93fdfbc984a86..fc2a0b481d78ebda325296f3d6acbbd3d420fae2 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/stat.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
+#include <linux/mm.h>
 
 #include <asm/segment.h>
 
index ff284a3993f9a015fdd96f6d26635502a3b7d53f..6a80a7cf0fa5c738fc8231c2eb1c8c50b3d232fc 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/signal.h>
 #include <linux/errno.h>
 #include <linux/personality.h>
+#include <linux/mm.h>
 
 #include <asm/segment.h>
 #include <asm/system.h>
index 70f5d166ebb1779c3835bd0462cc8c960344503b..dfd44c1699c4cb53134f0ece586eddef5384b687 100644 (file)
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -10,6 +10,8 @@
 #include <linux/fs.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
+#include <linux/mm.h>
+
 #include <asm/segment.h>
 
 static void cp_old_stat(struct inode * inode, struct old_stat * statbuf)
index f0fb850be212dd8b25c558190f8bf51907ff569b..eddbb0bea4a5040281b0307197a756306b44a05a 100644 (file)
  *  This file contains code for allocating/freeing blocks.
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/kernel.h>
 #include <linux/fs.h>
 #include <linux/sysv_fs.h>
index a4b01922877628df0308c34d5b6f3f7d1eb83dd6..1084c01c6d4d9d13683d3b1387d2b37a96feaf96 100644 (file)
  *  SystemV/Coherent directory handling functions
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 
 #include <linux/errno.h>
index a95e91ebbb0e0fd4016ed32fb531017eb5e35514..f098af6b6a0d75e17948449a0dfde63c70ed7d7a 100644 (file)
  *  SystemV/Coherent regular file handling primitives
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 
 #include <linux/kernel.h>
index 9e105077d5f01b08d0062be29570c75cd92d6e50..af1218fcaf514ab0b8ca3d5196a71ab03ca996c9 100644 (file)
  *  SystemV/Coherent fsync primitive
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/errno.h>
 #include <linux/stat.h>
 
index f87009100133eee4cd045c10d6ad121365b5167a..98883c22cb2229526e1095402a29a916d537b2ad 100644 (file)
  *  This file contains code for allocating/freeing inodes.
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/fs.h>
index 91e244b0c838d15969fa1981bfb811b670647648..85a20ae313f59a817f4971b4893b8cdfeeee9985 100644 (file)
  *  the superblock.
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#else
+#define MOD_INC_USE_COUNT
+#define MOD_DEC_USE_COUNT
+#endif
+
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/fs.h>
 
 #include <asm/segment.h>
 
-#ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
-
 void sysv_put_inode(struct inode *inode)
 {
        if (inode->i_nlink)
index 7c9e8b8f9673ae651e0ecf9f74a192350cfbf09c..8d245d38e2a24dc27c37f06a7609c325dac87224 100644 (file)
  *  Copyright (C) 1993  Bruno Haible
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/fs.h>
index d392816bc9b08342270e738ba15163c9b718ce06..c4e7d5bf5e67d722df79446348980740183c015a 100644 (file)
  *  SystemV/Coherent symlink handling code
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 
 #include <linux/errno.h>
index 21451e6dd79b6f6da7473521d7832e9097dd00dd..6de370ebdda72b7685fd955d0d46cf139e484769 100644 (file)
  *  Copyright (C) 1993  Bruno Haible
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/sched.h>
 #include <linux/fs.h>
 #include <linux/sysv_fs.h>
index 115634b9da8abdf666877275a86475f6e80e0b65..7fb060c7ae473cadda6967b6586f7873c80bd373 100644 (file)
@@ -1,3 +1,7 @@
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/system.h>
 
 #include <linux/signal.h>
index a99a56314e4478532e9a9ae328364573658de6dd..4efdfc484a682356405032417beab3c3b8ed6706 100644 (file)
@@ -7,6 +7,10 @@
  *  Extended MS-DOS directory handling functions
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 
 #include <linux/sched.h>
index e4d6a947082944ae0ddfb48abb5d417f419810a0..b1ec47bf678809cf756993ea5f5b1df8af47a367 100644 (file)
@@ -5,6 +5,10 @@
  *
  *  Extended MS-DOS directory handling functions
  */
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/types.h>
 #include <linux/fcntl.h>
 #include <linux/kernel.h>
index 224d976ba4949b7909414964c08b4ad502cdd9dd..fd3b80f87fbb45c908cada3ba4ed98bf856ac7f1 100644 (file)
@@ -7,6 +7,10 @@
  *  Extended MS-DOS regular file handling primitives
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 #include <asm/system.h>
 
index 25ab9e3445259da02e21f488ca680966427f3270..61fda6119867b08e30230be5eac106687a5bba88 100644 (file)
@@ -6,6 +6,14 @@
  *
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#else
+#define MOD_INC_USE_COUNT
+#define MOD_DEC_USE_COUNT
+#endif
+
 #include <linux/fs.h>
 #include <linux/msdos_fs.h>
 #include <linux/kernel.h>
 #include <linux/stat.h>
 #include <linux/umsdos_fs.h>
 
-#ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
-
 struct inode *pseudo_root=NULL;                /* Useful to simulate the pseudo DOS */
                                                                        /* directory. See UMSDOS_readdir_x() */
 
index 97257179644414b5e89ce218c9e8451527c0e2f0..fdb8bbc00d0055ebe72131dfffe25c96875587da 100644 (file)
@@ -5,6 +5,10 @@
  *
  *  Extended MS-DOS ioctl directory handling functions
  */
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
index 0fe3b54644231e39cd032fc65f551f32eeacdb0d..618f8aee4df76570fd03e1a780a2f3de76151ed0 100644 (file)
@@ -6,6 +6,10 @@
  * Control the mangling of file name to fit msdos name space.
  * Many optimisation by GLU == dglaude@is1.vub.ac.be (GLAUDE DAVID)
 */
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/errno.h>
 #include <linux/ctype.h>
 #include <linux/string.h>
index 2a59bf813a8f6d9dfc35042d2cbf5e1ede60c139..9b219f93c0cfe7c948a7db2264034b5ba1039766 100644 (file)
@@ -6,6 +6,10 @@
  *
  * Maintain and access the --linux alternate directory file.
 */
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
index 9421dfba6803bf8dc8928415f4cde0862ac52c65..78fef8532a471691f5ba5680ad87adaac2e5e55f 100644 (file)
@@ -7,6 +7,10 @@
  *  (For directory without EMD file).
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 
 #include <linux/sched.h>
index 1b1e561c2b245dba0051529ffe2472a23b8e8d07..6ab27c5dd8e92c5ca9e01cdaad4a21578467de36 100644 (file)
@@ -6,6 +6,9 @@
  *
  *  Extended MS-DOS regular file handling primitives
  */
+#ifdef MODULE
+#include <linux/module.h>
+#endif
 
 #include <asm/segment.h>
 #include <asm/system.h>
index 4dee5cfbb7242bf280e0c724ef4ab1874e62ae3f..bca7e4367a9c7457f132bf6e4a64fb1d4b328593 100644 (file)
 
 /* bitmap.c contains the code that handles the inode and block bitmaps */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/sched.h>
 #include <linux/locks.h>
 #include <linux/xia_fs.h>
index d9db56ddca5938e6d82bdce9bea8c93ea979fd44..4b611cc34d4cf048eacd92f2bcb7aaf10928858d 100644 (file)
@@ -9,6 +9,10 @@
  *  This software may be redistributed per Linux Copyright.
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 #include <linux/sched.h>
 #include <linux/errno.h>
index 5678ffd0bcb3675b9d26d611145cb7b599b9430f..c67daaed91eb6a001f864639ae0b0b591131e6dc 100644 (file)
@@ -9,6 +9,10 @@
  *  This software may be redistributed per Linux Copyright.
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 #include <asm/system.h>
 
index 67681b2c6175c7e0ce1e598785dc7f951a297c5b..5bd0a70668c0c536eb2408e9abfbd0e69a712211 100644 (file)
@@ -8,6 +8,10 @@
  *  xiafs fsync primitive
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 #include <asm/system.h>
 
index 0314cf921361a19aa7d11e6846cb4aadad03aa81..09a1ec192ce0f577f764a95a3f2854a044bafc38 100644 (file)
@@ -9,6 +9,14 @@
  *  This software may be redistributed per Linux Copyright.
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#include <linux/version.h>
+#else
+#define MOD_INC_USE_COUNT
+#define MOD_DEC_USE_COUNT
+#endif
+
 #include <linux/sched.h>
 #include <linux/xia_fs.h>
 #include <linux/kernel.h>
 #include <asm/system.h>
 #include <asm/segment.h>
 
-#ifdef MODULE
-#include <linux/module.h>
-#include <linux/version.h>
-#else
-#define MOD_INC_USE_COUNT
-#define MOD_DEC_USE_COUNT
-#endif
-
 #include "xiafs_mac.h"
 
 static u_long random_nr;
index 2697ab0412349205566bfbf7382ebf7e2b1f350c..46b3590b2b937d256a0b9224b494fdfcfce4c32f 100644 (file)
@@ -9,6 +9,10 @@
  *  This software may be redistributed per Linux Copyright.
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/sched.h>
 #include <linux/xia_fs.h>
 #include <linux/kernel.h>
index 757ad57969607ba0e97bd5e0ea19457dba85ccab..1c64ebc6dca11d2bf739dc05d1a0c44385e834e1 100644 (file)
@@ -9,6 +9,10 @@
  *  This software may be redistributed per Linux Copyright.
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <asm/segment.h>
 
 #include <linux/errno.h>
index bdb9d39be059b494e6e92d9698f9630db30d2551..2e8dec10d2415a3a333325447c3dc56dee621661 100644 (file)
@@ -9,6 +9,10 @@
  *  This software may be redistributed per Linux Copyright.
  */
 
+#ifdef MODULE
+#include <linux/module.h>
+#endif
+
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/xia_fs.h>
index 5d305670d4d836f749862d5af3177d21de381329..774afcdd00412560de80d18c12553d95c4e0bd69 100644 (file)
@@ -29,6 +29,9 @@ __asm__ __volatile__( \
 
 typedef unsigned int mem_map_t;
 
+#define VMALLOC_START          0xFFFFFE0000000000
+#define VMALLOC_VMADDR(x)      ((unsigned long)(x))
+
 #ifdef CONFIG_STRICT_MM_TYPECHECKS
 /*
  * These are used to make use of C type-checking..
@@ -108,7 +111,7 @@ typedef unsigned long pgprot_t;
 #define PAGE_SHARED    __pgprot(_PAGE_VALID | __ACCESS_BITS)
 #define PAGE_COPY      __pgprot(_PAGE_VALID | __ACCESS_BITS | _PAGE_FOW | _PAGE_COW)
 #define PAGE_READONLY  __pgprot(_PAGE_VALID | __ACCESS_BITS | _PAGE_FOW)
-#define PAGE_KERNEL    __pgprot(_PAGE_VALID | _PAGE_ASM | __ACCESS_BITS | __DIRTY_BITS)
+#define PAGE_KERNEL    __pgprot(_PAGE_VALID | _PAGE_ASM | _PAGE_KRE | _PAGE_KWE)
 
 #define _PAGE_NORMAL(x) __pgprot(_PAGE_VALID | __ACCESS_BITS | (x))
 
@@ -164,14 +167,6 @@ extern unsigned long __zero_page(void);
 /* sizeof(void*)==1<<SIZEOF_PTR_LOG2 */
 #define SIZEOF_PTR_LOG2                        3
 
-/* to find an entry in a page-table-directory */
-/*
- * XXXXX This isn't right: we shouldn't use the ptbr, but the L2 pointer.
- * This is just for getting it through the compiler right now
- */
-#define PAGE_DIR_OFFSET(tsk,address) \
-((pgd_t *) ((tsk)->tss.ptbr + ((((unsigned long)(address)) >> 21) & PTR_MASK & ~PAGE_MASK)))
-
 /* to find an entry in a page-table */
 #define PAGE_PTR(address)              \
   ((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK)
@@ -180,16 +175,19 @@ extern unsigned long __zero_page(void);
 #define PTRS_PER_PAGE                  (PAGE_SIZE/sizeof(void*))
 
 /* to set the page-dir */
-/*
- * XXXXX This isn't right: we shouldn't use the ptbr, but the L2 pointer.
- * This is just for getting it through the compiler right now
- */
-#define SET_PAGE_DIR(tsk,pgdir) \
-do { \
-       (tsk)->tss.ptbr = (unsigned long) (pgdir); \
-       if ((tsk) == current) \
-               invalidate(); \
-} while (0)
+extern inline void SET_PAGE_DIR(struct task_struct * tsk, pgd_t * pgdir)
+{
+       tsk->tss.ptbr = ((unsigned long) pgdir - PAGE_OFFSET) >> PAGE_SHIFT;
+       if (tsk == current)
+               invalidate();
+}
+
+/* to find an entry in a page-table-directory */
+extern inline pgd_t * PAGE_DIR_OFFSET(struct task_struct * tsk, unsigned long address)
+{
+       return (pgd_t *) ((tsk->tss.ptbr << PAGE_SHIFT) + PAGE_OFFSET) +
+               ((address >> 33) & PTR_MASK);
+}
 
 extern unsigned long high_memory;
 
index 57624ddbb99f05c14c8456c87a44fe08a79ed0cf..a5079073ab5ed41f95e24b05077cd1daa73be4b4 100644 (file)
  * Bus types
  */
 #define EISA_bus 1
+#define EISA_bus__is_a_macro /* for versions in ksyms.c */
 #define MCA_bus 0
+#define MCA_bus__is_a_macro /* for versions in ksyms.c */
 
 /*
  * The alpha has no problems with write protection
  */
 #define wp_works_ok 1
+#define wp_works_ok__is_a_macro /* for versions in ksyms.c */
 
 struct thread_struct {
        unsigned long ksp;
index e6ec3a81bd759007c758834ef9e675601175c32f..257554e1efdc5884e45e5b2a3479ae7a68c351e6 100644 (file)
@@ -20,6 +20,17 @@ __asm__ __volatile__("movl %%cr3,%%eax\n\tmovl %%eax,%%cr3": : :"ax")
 
 typedef unsigned short mem_map_t;
 
+/* Just any arbitrary offset to the start of the vmalloc VM area: the
+ * current 8MB value just means that there will be a 8MB "hole" after the
+ * physical memory until the kernel virtual memory starts.  That means that
+ * any out-of-bounds memory accesses will hopefully be caught.
+ * The vmalloc() routines leaves a hole of 4kB between each vmalloced
+ * area for the same reason. ;)
+ */
+#define VMALLOC_OFFSET (8*1024*1024)
+#define VMALLOC_START ((high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
+#define VMALLOC_VMADDR(x) (TASK_SIZE + (unsigned long)(x))
+
 #ifdef CONFIG_STRICT_MM_TYPECHECKS
 /*
  * These are used to make use of C type-checking..
index fd3ae78b40aa083d3d82c28280d65b9d7cc34a97..86edb1ed0b8b26d156c37ed5ebf16f5b2a85e799 100644 (file)
@@ -33,6 +33,7 @@ __asm__ __volatile__("decl _intr_count")
  */
 extern int EISA_bus;
 #define MCA_bus 0
+#define MCA_bus__is_a_macro /* for versions in ksyms.c */
 
 /*
  * User space process size: 3GB. This is hardcoded into a few places,
index 7ba48dbd84461c82de304253d0f809c525fbe9f4..358113b6b7081b9d0074ef7d98b09fb2d3c36b2e 100644 (file)
@@ -68,11 +68,13 @@ __asm__ __volatile__(            \
  */
 extern int EISA_bus;
 #define MCA_bus 0
+#define MCA_bus__is_a_macro /* for versions in ksyms.c */
 
 /*
  * MIPS has no problems with write protection
  */
 #define wp_works_ok 1
+#define wp_works_ok__is_a_macro /* for versions in ksyms.c */
 
 /*
  * User space process size: 2GB. This is hardcoded into a few places,
diff --git a/include/asm-sparc/cprefix.h b/include/asm-sparc/cprefix.h
new file mode 100644 (file)
index 0000000..20fbbf5
--- /dev/null
@@ -0,0 +1,20 @@
+/* cprefix.h:  This file is included by assembly source which needs
+ *             to know what the c-label prefixes are. The newer versions
+ *            of cpp that come with gcc predefine such things to help
+ *            us out. The reason this stuff is neaded is to make
+ *            solaris compiles of the kernel work.
+ *
+ * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
+ */
+
+
+#ifndef __svr4__
+#define C_LABEL_PREFIX _
+#else
+#define C_LABEL_PREFIX
+#endif
+
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a##b
+
+#define C_LABEL(name) CONCAT1(C_LABEL_PREFIX, name)
diff --git a/include/asm-sparc/idprom.h b/include/asm-sparc/idprom.h
new file mode 100644 (file)
index 0000000..e7a1368
--- /dev/null
@@ -0,0 +1,21 @@
+/* idprom.h: Macros and defines for idprom routines
+ *
+ * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
+ */
+
+extern struct linux_romvec *romvec;
+
+#define IDPROM_ADDR  (0xffd04000 + 0x7d8)
+#define IDPROM_SIZE  36
+
+struct idp_struct
+{
+  unsigned char id_f_id;      /* format identifier */
+  unsigned char id_machtype;  /* Machine type */
+  unsigned char id_eaddr[6];  /* hardware ethernet address */
+  long id_domf;               /* Date when this machine was manufactured */
+  unsigned int id_sernum:24;  /* Unique serial number */
+  unsigned char id_cksum;     /* XXX */
+  unsigned char dummy[16];    /* XXX */
+};
+
index 131486a8a95c815c94b08e7bc16ac9497c7eee33..cd0bbb84b4e60e38e2cc8c317c9ac259dd908e7e 100644 (file)
 #define PAGE_SIZE    4096
 #define PGDIR_SIZE   (1UL << PGDIR_SHIFT)
 
+#define PAGE_OFFSET    0
+#define MAP_NR(addr) (((addr)) >> PAGE_SHIFT)
+#define MAP_PAGE_RESERVED (1<<31)
+
+
+
+#define PAGE_PRESENT   0x001
+#define PAGE_RW                0x002
+#define PAGE_USER      0x004
+#define PAGE_ACCESSED  0x020
+#define PAGE_DIRTY     0x040
+#define PAGE_COW       0x200   /* implemented in software (one of the AVL bits) */
+
+#define PAGE_PRIVATE   (PAGE_PRESENT | PAGE_RW | PAGE_USER | PAGE_ACCESSED | PAGE_COW)
+#define PAGE_SHARED    (PAGE_PRESENT | PAGE_RW | PAGE_USER | PAGE_ACCESSED)
+#define PAGE_COPY      (PAGE_PRESENT | PAGE_USER | PAGE_ACCESSED | PAGE_COW)
+#define PAGE_READONLY  (PAGE_PRESENT | PAGE_USER | PAGE_ACCESSED)
+#define PAGE_EXECONLY  (PAGE_PRESENT | PAGE_USER | PAGE_ACCESSED)
+#define PAGE_TABLE     (PAGE_PRESENT | PAGE_RW | PAGE_USER | PAGE_ACCESSED)
+
+#define PAGE_CHG_MASK (PAGE_MASK | PAGE_ACCESSED | PAGE_DIRTY)
+
 #ifdef __KERNEL__
 
+/* number of bits that fit into a memory pointer */
 #define BITS_PER_PTR      (8*sizeof(unsigned long))   /* better check this stuff */
+
+/* to mask away the intra-page address bits */
 #define PAGE_MASK         (~(PAGE_SIZE-1))
+
+/* to mask away the intra-page address bits */
 #define PGDIR_MASK        (~(PGDIR_SIZE-1))
+
+/* to align the pointer to the (next) page boundary */
 #define PAGE_ALIGN(addr)  (((addr)+PAGE_SIZE-1)&PAGE_MASK)
 #define PGDIR_ALIGN(addr) (((addr)+PGDIR_SIZE-1)&PGDIR_MASK)
+
+/* to align the pointer to a pointer address */
 #define PTR_MASK          (~(sizeof(void*)-1))
 
 
  */
 
 #ifndef __ASSEMBLY__ /* for head.S */
+/*
+ * BAD_PAGETABLE is used when we need a bogus page-table, while
+ * BAD_PAGE is used for a bogus page.
+ *
+ * ZERO_PAGE is a global shared page that is always zero: used
+ * for zero-mapped memory areas etc..
+ */
+extern unsigned long __bad_page(void);
+extern unsigned long __bad_pagetable(void);
+extern unsigned long __zero_page(void);
+
+typedef unsigned int mem_map_t;
+
+#define BAD_PAGETABLE __bad_pagetable()
+#define BAD_PAGE __bad_page()
+#define ZERO_PAGE __zero_page()
+
 extern __inline__ unsigned long get_segmap(unsigned long addr)
 {
   register unsigned long entry;
 
   __asm__ __volatile__("lduha [%1] 0x3, %0" : 
                       "=r" (entry) :
-                      "r" (addr)); 
+                      "r" (addr));
 
   return entry;
 }
diff --git a/include/asm-sparc/param.h b/include/asm-sparc/param.h
new file mode 100644 (file)
index 0000000..45a9133
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef _ASMSPARC_PARAM_H
+#define _ASMSPARC_PARAM_H
+
+#ifndef HZ
+#define HZ 100
+#endif
+
+#define EXEC_PAGESIZE  4096
+
+#ifndef NGROUPS
+#define NGROUPS                32
+#endif
+
+#ifndef NOGROUP
+#define NOGROUP                (-1)
+#endif
+
+#define MAXHOSTNAMELEN 64      /* max length of hostname */
+
+#endif
index ed8b3f32e18b560344d54d35d8bd98010594aa05..af6e3b58e61fe672d2b8e7505e9da9b0e9e1bf17 100644 (file)
  * Bus types
  */
 #define EISA_bus 1
+#define EISA_bus__is_a_macro /* for versions in ksyms.c */
 #define MCA_bus 0
+#define MCA_bus__is_a_macro /* for versions in ksyms.c */
 
 /*
  * Write Protection works right in supervisor mode on the Sparc
  */
 
 #define wp_works_ok 1
+#define wp_works_ok__is_a_macro /* for versions in ksyms.c */
 
 /*
  * User space process size: 3GB. This is hardcoded into a few places,
diff --git a/include/asm-sparc/signal.h b/include/asm-sparc/signal.h
new file mode 100644 (file)
index 0000000..2e599e1
--- /dev/null
@@ -0,0 +1,11 @@
+#ifndef _ASMSPARC_SIGNAL_H
+#define _ASMSPARC_SIGNAL_H
+
+struct sigcontext_struct {
+       /*
+        * Have to find out what SUNOS and Solaris do. This could
+        * get real ugly. David S. Miller (davem@caip.rutgers.edu)
+        */
+};
+
+#endif
index 2ae234376e945811f8d570dc0e3667d5dcda73cd..6e0bfc1f7d466515a396b0dca29592eb78120d58 100644 (file)
@@ -4,9 +4,13 @@
    Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
 */
 
-extern __inline__ size_t strlen(const char* str)
+extern inline size_t strlen(const char * str)
 {
-  register int retval, tmp;
+  register size_t retval = 0;
+  register char tmp = 0;
+  register char * lstr;
+
+  lstr = (char *) str;
 
   __asm__("ldub [%1], %2\n\t"
          "or %%g0, %%g0, %0\n\t"
@@ -19,16 +23,16 @@ extern __inline__ size_t strlen(const char* str)
          "bne 1b\n\t"
          "add %1, 0x1, %1\n\t"
          "2:" :
-         "=r" (retval) :
-         "r" (str), "r" (tmp=0));
+         "=r" (retval), "=r" (lstr), "=r" (tmp) :
+         "0" (retval), "1" (lstr), "2" (tmp));
 
   return retval;
 }
 
 extern __inline__ int strcmp(const char* str1, const char* str2)
 {
-  register unsigned int tmp1, tmp2;
-  register int retval;
+  register unsigned int tmp1=0, tmp2=0;
+  register int retval=0;
 
   __asm__("ldub [%1], %3\n\t"
          "ldub [%2], %4\n\t"
@@ -47,37 +51,35 @@ extern __inline__ int strcmp(const char* str1, const char* str2)
          "ldub [%2], %4\n\t"
           "sub %3, %4, %0\n\t"
          "3: \n\t" :
-         "=r" (retval) :
-         "r" (str1), "r" (str2),
-         "r" (tmp1=0), "r" (tmp2=0));
+         "=r" (retval), "=r" (str1), "=r" (str2), "=r" (tmp1), "=r" (tmp2) :
+         "0" (retval), "1" (str1), "2" (str2),
+         "3" (tmp1), "4" (tmp2));
 
   return retval;
 }
 
 extern __inline__ int strncmp(const char* str1, const char* str2, size_t strlen)
 {
-  register char tmp1, tmp2;
-  register int retval;
+  register int retval=0;
 
   __asm__("cmp %3, 0x0\n\t"
          "be 2f\n\t"
-         "ldub [%2], %5\n\t"
-         "1: ldub [%1], %4\n\t"
-         "sub %4, %5, %0\n\t"
+         "ldub [%2], %%g3\n\t"
+         "1: ldub [%1], %%g2\n\t"
+         "sub %%g2, %%g3, %0\n\t"
          "cmp %0, 0x0\n\t"
          "bne 2f\n\t"
          "add %2, 0x1, %2\n\t"
-         "cmp %4, 0x0\n\t"
+         "cmp %%g2, 0x0\n\t"
          "be 2f\n\t"
          "add %1, 0x1, %1\n\t"
          "addcc %3, -1, %3\n\t"
          "bne,a 1b\n\t"
-         "ldub [%2], %5\n\t"
+         "ldub [%2], %%g3\n\t"
          "2: " :
-         "=r" (retval) :
-         "r" (str1), "r" (str2),
-         "r" (strlen), "r" (tmp1=0),
-         "r" (tmp2=0));
+         "=r" (retval), "=r" (str1), "=r" (str2), "=r" (strlen) :
+         "0" (retval), "1" (str1), "2" (str2), "3" (strlen) :
+         "%g2", "%g3");
 
   return retval;
 }
@@ -94,8 +96,8 @@ extern __inline__ char *strcpy(char* dest, const char* source)
          "cmp %3, 0x0\n\t"
          "bne,a 1b\n\t"
          "ldub [%1], %3\n\t" :
-         "=r" (retval) :
-         "r" (source), "r" (dest), "r" (tmp));
+         "=r" (retval), "=r" (source), "=r" (dest), "=r" (tmp) :
+         "0" (retval), "1" (source), "2" (dest), "3" (tmp));
 
   return retval;
 }
@@ -114,9 +116,9 @@ extern __inline__ char *strncpy(char *dest, const char *source, size_t cpylen)
          "sub %4, 0x1, %4\n\t"
          "ba 1\n\t"
          "add %2, 0x1, %2\n\t" :
-         "=r" (retval) :
-         "r" (dest), "r" (source), 
-         "r" (tmp), "r" (cpylen));
+         "=r" (retval), "=r" (dest), "=r" (source), "=r"(tmp), "=r" (cpylen) :
+         "0" (retval), "1" (dest), "2" (source), 
+         "3" (tmp), "4" (cpylen));
 
   return retval;
 }
@@ -124,7 +126,7 @@ extern __inline__ char *strncpy(char *dest, const char *source, size_t cpylen)
 extern __inline__ char *strcat(char *dest, const char *src)
 {
   register char *retval;
-  register char temp;
+  register char temp=0;
 
   __asm__("or %%g0, %1, %0\n\t"
          "1: ldub [%1], %3\n\t"
@@ -137,8 +139,8 @@ extern __inline__ char *strcat(char *dest, const char *src)
          "cmp %3, 0x0\n\t"
          "bne 2b\n\t"
          "add %2, 0x1, %2\n\t" :
-         "=r" (retval) :
-         "r" (dest), "r" (src), "r" (temp=0));
+         "=r" (retval), "=r" (dest), "=r" (src), "=r" (temp) :
+         "0" (retval), "1" (dest), "2" (src), "3" (temp));
 
   return retval;
 }
@@ -146,7 +148,7 @@ extern __inline__ char *strcat(char *dest, const char *src)
 extern __inline__ char *strncat(char *dest, const char *src, size_t len)
 {
   register char *retval;
-  register char temp;
+  register char temp=0;
 
   __asm__("or %%g0, %1, %0\n\t"
          "1: ldub [%1], %3\n\t"
@@ -160,24 +162,24 @@ extern __inline__ char *strncat(char *dest, const char *src, size_t len)
          "cmp %3, 0x0\n\t"
          "bne 2b\n\t"
          "add %2, 0x1, %2\n\t" :
-         "=r" (retval) :
-         "r" (dest), "r" (src), "r" (len), "r" (temp=0));
+         "=r" (retval), "=r" (dest), "=r" (src), "=r" (len), "=r" (temp) :
+         "0" (retval), "1" (dest), "2" (src), "3" (len), "4" (temp));
 
   return retval;
 }
 
 extern __inline__ char *strchr(const char *src, int c)
 {
-  register char temp;
-  register char *trick;
+  register char temp=0;
+  register char *trick=0;
 
   __asm__("1: ldub [%0], %2\n\t"
          "cmp %2, %1\n\t"
          "bne,a 1b\n\t"
          "add %0, 0x1, %0\n\t"
          "or %%g0, %0, %3\n\t" :
-         "=r" (src) :
-         "r" (c), "r" (temp=0), "r" (trick=0), "0" (src));
+         "=r" (src), "=r" (c), "=r" (temp), "=r" (trick), "=r" (src) :
+         "0" (src), "1" (c), "2" (temp), "3" (trick), "4" (src));
 
   return trick;
 }
@@ -281,8 +283,8 @@ extern __inline__ void *memset(void *src, int c, size_t count)
          "cmp %3, -1\n\t"
          "bne,a 1b\n\t"
          "stb %2, [%1]\n\t" :
-         "=r" (retval) :
-         "r" (src), "r" (c), "r" (count));
+         "=r" (retval), "=r" (src), "=r" (c), "=r" (count) :
+         "0" (retval), "1" (src), "2" (c), "3" (count));
 
   return retval;
 }
@@ -304,8 +306,8 @@ extern __inline__ void *memcpy(void *dest, const void *src, size_t count)
          "bne 1b\n\t"
          "add %1, 0x1, %1\n\t"
          "2: " :
-         "=r" (retval) :
-         "r" (dest), "r" (src), "r" (count), "r" (tmp));
+         "=r" (retval), "=r" (dest), "=r" (src), "=r" (count), "=r" (tmp) :
+         "0" (retval), "1" (dest), "2" (src), "3" (count), "4" (tmp));
 
   return retval;
 }
@@ -327,8 +329,8 @@ extern __inline__ void *memmove(void *dest, const void *src, size_t count)
          "bne 1b\n\t"
          "add %1, 0x1, %1\n\t"
          "2: " :
-         "=r" (retval) :
-         "r" (dest), "r" (src), "r" (count), "r" (tmp));
+         "=r" (retval), "=r" (dest), "=r" (src), "=r" (count), "=r" (tmp) :
+         "0" (retval), "1" (dest), "2" (src), "3" (count), "4" (tmp));
 
   return retval;
 }
index 95fdf01f89f0dffdd9f38579ff9503e828088677..9baf1eb37954371bede4fa6a7b0545c5daf685cb 100644 (file)
@@ -23,6 +23,9 @@
 #define INIT_STACK     0x00013fe0
 #define START_ADDR     0x00004000
 #define START_SIZE     (32*1024)
+#define EMPTY_PGT      0x00001000
+#define EMPTY_PGE      0x00001000
+#define ZERO_PGE       0x00001000
 
 #ifndef __ASSEMBLY__
 
@@ -38,23 +41,22 @@ extern struct linux_romvec *romvec;
 #define stbar() __asm__ __volatile__("stbar": : :"memory")
 #endif
 
-/* Changing the PIL on the sparc is a bit hairy. I figure out some
- * more optimized way of doing this soon.
+/* Changing the PIL on the sparc is a bit hairy. I'll figure out some
+ * more optimized way of doing this soon. This is bletcherous code.
  */
 
 #define swpipl(__new_ipl) \
 ({ unsigned long __old_ipl, psr; \
 __asm__ __volatile__( \
-       "and %1, 15, %1\n\t" \
-       "sll %1, 8, %1\n\t" \
-       "rd %%psr, %2\n\t" \
-       "or %%g0, %2, %0\n\t" \
-       "or %2, %1, %2\n\t" \
-       "wr %2, 0x0, %%psr\n\t" \
-       "srl %0, 8, %0\n\t" \
-        "and %0, 15, %0\n\t" \
-       : "=r" (__old_ipl) \
-       : "r" (__new_ipl), "r" (psr=0)); \
+        "rd %%psr, %0\n\t" : "=&r" (__old_ipl)); \
+__asm__ __volatile__( \
+       "and %1, 15, %0\n\t" \
+       "sll %0, 8, %0\n\t" \
+       "or  %0, %2, %0\n\t" \
+       "wr  %0, 0x0, %%psr\n\t" \
+       : "=&r" (psr) \
+       : "r" (__new_ipl), "r" (__old_ipl)); \
+__old_ipl = ((__old_ipl>>8)&15); \
 __old_ipl; })
 
 #define cli()                  swpipl(15)  /* 15 = no int's except nmi's */
@@ -63,7 +65,7 @@ __old_ipl; })
 #define restore_flags(flags)   swpipl(flags)
 
 #define iret() __asm__ __volatile__ ("jmp %%l1\n\t" \
-                                    "rett %l2\n\t": : :"memory")
+                                    "rett %%l2\n\t": : :"memory")
 
 #define _set_gate(gate_addr,type,dpl,addr) \
 __asm__ __volatile__ ("nop\n\t")
index 721716aa0e9966bd09c502a250422f3d959a4fcf..c7b65be7a5f989f356877d02f2054ea5734f3975 100644 (file)
 
 #ifndef _SIZE_T
 #define _SIZE_T
-typedef long unsigned int size_t;
+#ifdef __svr4__
+typedef unsigned int size_t;      /* solaris sucks */
+#else
+typedef long unsigned int size_t; /* sunos is much better */
+#endif /* !(__svr4__) */
 #endif
 
 #ifndef _SSIZE_T
index 864d9c8447ca2f0ff56a5d4b2a0a1bac5194806c..83dd3fef26c2e904273f98012788c4c4ad792191 100644 (file)
@@ -7,10 +7,17 @@
    Copyright (C) 1994, David S. Miller (davem@caip.rutgers.edu)
 */
 
+extern unsigned int trapbase[];
+extern unsigned int end[], etext[], msgbuf[];
+
 extern void flush_vac_context(void);
 extern void flush_vac_segment(unsigned int foo_segment);
 extern void flush_vac_page(unsigned int foo_addr);
 
+extern int vac_do_hw_vac_flushes, vac_size, vac_linesize;
+extern int vac_entries_per_context, vac_entries_per_segment;
+extern int vac_entries_per_page;
+
 /* enable_vac() enables the virtual address cache. It returns 0 on
    success, 1 on failure.
 */
@@ -69,12 +76,12 @@ extern __inline__ void sw_flush_vac_segment_entry(char* addr)
   __asm__ __volatile__("sta %%g0, [%0] 0xc" : : "r" (addr));
 }
 
-extern __inline__ void hw_flush_vac_page_entry(char* addr)
+extern __inline__ void hw_flush_vac_page_entry(unsigned long* addr)
 {
   __asm__ __volatile__("sta %%g0, [%0] 0x6" : : "r" (addr));
 }
 
-extern __inline__ void sw_flush_vac_page_entry(char* addr)
+extern __inline__ void sw_flush_vac_page_entry(unsigned long* addr)
 {
   __asm__ __volatile__("sta %%g0, [%0] 0xd" : : "r" (addr));
 }
index b803b8b8dfb4eff630b02e6e7b99d1e47f5d5e49..b0105150c64927220af848d13580d7e639c972d1 100644 (file)
@@ -2,6 +2,7 @@
 #define _LINUX_MALLOC_H
 
 #include <linux/config.h>
+#include <linux/mm.h>
 
 #ifdef CONFIG_DEBUG_MALLOC
 #define kmalloc(a,b) deb_kmalloc(__FILE__,__LINE__,a,b)
index 8249c8e594b58f46f44ef974c2dcbc7cb7034747..c21f29cc4139967eb9308567639888f4430d953e 100644 (file)
@@ -1,15 +1,15 @@
 #ifndef _LINUX_MM_H
 #define _LINUX_MM_H
 
-extern unsigned long high_memory;
-
-#include <asm/page.h>
-
 #include <linux/sched.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
 
+extern unsigned long high_memory;
+
+#include <asm/page.h>
+
 #define VERIFY_READ 0
 #define VERIFY_WRITE 1
 
index 12a1e9b0ea582153d9b9174d858ddf21135ad0e7..f9419b2f9c76f5fd95976b23f89e7f0b9f92854e 100644 (file)
@@ -12,7 +12,7 @@
 #define MAP_FIXED        0x10      /* Interpret addr exactly */
 #define MAP_ANONYMOUS    0x20      /* don't use a file */
 
-#define MAP_GROWSDOWN  0x0400          /* stack-like segment */
+#define MAP_GROWSDOWN  0x0100          /* stack-like segment */
 #define MAP_DENYWRITE  0x0800          /* ETXTBSY */
 #define MAP_EXECUTABLE 0x1000          /* mark it as a executable */
 
index b82fa281b65808840718d12bc666c5d3a7e851b1..699c13ccf2b8b05857fd923f2f099e2ac80e6cf9 100644 (file)
@@ -7,6 +7,22 @@
 #ifndef _LINUX_MODULE_H
 #define _LINUX_MODULE_H
 
+#ifdef CONFIG_MODVERSIONS
+# ifndef __GENKSYMS__
+#  ifdef MODULE
+#   define _set_ver(sym,vers) sym ## _R ## vers
+#   include <linux/modversions.h>
+#  else /* MODULE */
+#   ifdef EXPORT_SYMTAB
+#    define _set_ver(sym,vers) sym
+#    include <linux/modversions.h>
+#   endif /* EXPORT_SYMTAB */
+#  endif /* MODULE */
+# else /* __GENKSYMS__ */
+#  define _set_ver(sym,vers) sym
+#  endif /* __GENKSYMS__ */
+#endif /* CONFIG_MODVERSIONS */
+
 /* values of module.state */
 #define MOD_UNINITIALIZED 0
 #define MOD_RUNNING 1
@@ -63,6 +79,8 @@ struct mod_routines {
 /* rename_module_symbol(old_name, new_name)  WOW! */
 extern int rename_module_symbol(char *, char *);
 
+/* insert new symbol table */
+extern int register_symtab(struct symbol_table *);
 
 /*
  * The first word of the module contains the use count.
@@ -73,6 +91,9 @@ extern int rename_module_symbol(char *, char *);
  */
 
 extern int 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
 
 #define MOD_INC_USE_COUNT      mod_use_count_++
 #define MOD_DEC_USE_COUNT      mod_use_count_--
index 8bdf6edd0c0781d3256548afcd67bfba578e8f68..09067d9c70bee781d4c8b9fb77f75b4f6d5c1429 100644 (file)
@@ -291,18 +291,28 @@ struct pci_class_type {
 #define PCI_VENDOR_ID_TRIDENT          0x1023
 #define PCI_DEVICE_ID_TRIDENT_9420     0x9420
 
-#define PCI_VENDOR_ID_CONTAQ           0x1023
+#define PCI_VENDOR_ID_CONTAQ           0x1080
 #define PCI_DEVICE_ID_CONTAQ_82C599    0x0600
 
 #define PCI_VENDOR_ID_NS               0x100b
 
+#define PCI_VENDOR_ID_VIA              0x1106
+#define PCI_DEVICE_ID_VIA_82C505       0x0505
+
+#define PCI_VENDOR_ID_SI               0x1039
+#define PCI_DEVICE_ID_SI_MG1936                0x0406
+#define PCI_DEVICE_ID_SI_MG1938                0x0008
+
+#define PCI_VENDOR_ID_LEADTEK          0x107d
+#define PCI_DEVICE_ID_LEADTEK_805      0x0000
+
 struct pci_vendor_type {
        unsigned short vendor_id;
        char *vendor_name;
 };
 
 
-#define PCI_VENDOR_NUM 27
+#define PCI_VENDOR_NUM 30
 #define PCI_VENDOR_TYPE { \
        {PCI_VENDOR_ID_NCR,             "NCR"}, \
        {PCI_VENDOR_ID_ADAPTEC,         "Adaptec"}, \
@@ -330,7 +340,10 @@ struct pci_vendor_type {
        {PCI_VENDOR_ID_SYMPHONY,        "Symphony"}, \
        {PCI_VENDOR_ID_TRIDENT,         "Trident"}, \
        {PCI_VENDOR_ID_CONTAQ,          "Contaq"}, \
-       {PCI_VENDOR_ID_NS,              "NS"} \
+       {PCI_VENDOR_ID_NS,              "NS"}, \
+       {PCI_VENDOR_ID_VIA,             "VIA Technologies"}, \
+       {PCI_VENDOR_ID_SI,              "Silicon Integrated"}, \
+       {PCI_VENDOR_ID_LEADTEK,         "Leadtek Research"} \
 }
 
 
@@ -349,7 +362,7 @@ struct pci_device_type {
        char *device_name;
 };
 
-#define PCI_DEVICE_NUM 50
+#define PCI_DEVICE_NUM 54
 #define PCI_DEVICE_TYPE { \
        {0xff,  PCI_VENDOR_ID_NCR,      PCI_DEVICE_ID_NCR_53C810,       "53c810"}, \
        {0xff,  PCI_VENDOR_ID_NCR,      PCI_DEVICE_ID_NCR_53C815,       "53c815"}, \
@@ -400,7 +413,11 @@ struct pci_device_type {
        {0xff,  PCI_VENDOR_ID_ADL,      PCI_DEVICE_ID_ADL_2301,         "2301"}, \
        {0xff,  PCI_VENDOR_ID_SYMPHONY, PCI_DEVICE_ID_SYMPHONY_101,     "82C101"}, \
        {0xff,  PCI_VENDOR_ID_TRIDENT,  PCI_DEVICE_ID_TRIDENT_9420,     "TG 9420"}, \
-       {0xff,  PCI_VENDOR_ID_CONTAQ,   PCI_DEVICE_ID_CONTAQ_82C599,    "82C599"} \
+       {0xff,  PCI_VENDOR_ID_CONTAQ,   PCI_DEVICE_ID_CONTAQ_82C599,    "82C599"}, \
+       {0xff,  PCI_VENDOR_ID_VIA,      PCI_DEVICE_ID_VIA_82C505,       "VT 82C505"}, \
+       {0xff,  PCI_VENDOR_ID_SI,       PCI_DEVICE_ID_SI_MG1936,        "MG1936 ??"}, \
+       {0xff,  PCI_VENDOR_ID_SI,       PCI_DEVICE_ID_SI_MG1938,        "MG1938 ??"}, \
+       {0xff,  PCI_VENDOR_ID_LEADTEK,  PCI_DEVICE_ID_LEADTEK_805,      "S3 805"} \
 }
 
 /* An item of this structure has the following meaning */
index 6210530c15d94d3a652f1d54cd5a9c2920f06ef4..4dcdb8ead1b526e75def51a4708f19d1281f52ab 100644 (file)
@@ -17,6 +17,7 @@ extern unsigned long event;
 #include <linux/binfmts.h>
 #include <linux/personality.h>
 #include <linux/tasks.h>
+#include <linux/kernel.h>
 #include <asm/system.h>
 
 /*
@@ -51,7 +52,6 @@ extern unsigned long avenrun[];               /* Load averages */
 
 #include <linux/head.h>
 #include <linux/fs.h>
-#include <linux/mm.h>
 #include <linux/signal.h>
 #include <linux/time.h>
 #include <linux/param.h>
diff --git a/include/linux/symtab_begin.h b/include/linux/symtab_begin.h
new file mode 100644 (file)
index 0000000..c6f6936
--- /dev/null
@@ -0,0 +1,16 @@
+#ifdef CONFIG_MODVERSIONS /* CONFIG_MODVERSIONS */
+#undef _set_ver
+#undef X
+#ifndef __GENKSYMS__
+#ifdef MODULE
+#define _set_ver(sym,ver) { (void *) & sym ## _R ## ver, "_" #sym "_R" #ver }
+#else /* MODULE */
+#define _set_ver(sym,ver) { (void *) & sym, "_" #sym "_R" #ver }
+#endif /* MODULE */
+#define X(a) a
+#endif /* __GENKSYMS__ */
+#else /* CONFIG_MODVERSIONS */
+#define X(sym) { (void *) & sym, "_" #sym }
+#endif /* CONFIG_MODVERSIONS */
+#define EMPTY {0,0}
+       0, 0, 0, {
diff --git a/include/linux/symtab_end.h b/include/linux/symtab_end.h
new file mode 100644 (file)
index 0000000..4fbd50f
--- /dev/null
@@ -0,0 +1,15 @@
+#ifdef CONFIG_MODVERSIONS /* CONFIG_MODVERSIONS */
+#undef _set_ver
+#if defined(MODULE) && !defined(__GENKSYMS__)
+#define _set_ver(sym,vers) sym ## _R ## vers
+#else
+#define _set_ver(a,b) a
+#endif
+#endif /* CONFIG_MODVERSIONS */
+#undef X
+#undef EMPTY
+        /* mark end of table, last entry above ended with a comma! */
+        { (void *)0, (char *)0 }
+       },
+       /* no module refs, insmod will take care of that instead! */
+       { { (struct module *)0, (struct module_ref *)0 } }
index 6d22f32a6ea5ee13b3a54a3274c0e14c7d201300..afe0e6ff615588d6ddf89451591a00747c125789 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/utsname.h>
 #include <linux/ioport.h>
 #include <linux/hdreg.h>
+#include <linux/mm.h>
 
 #include <asm/bugs.h>
 
index 6337cbff06a8f64e3718e566d3cbc32d6884978c..a99c4a76f86648a3b4502ca091b35cf0273f4908 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -396,7 +396,7 @@ static inline void remove_attach (struct shmid_ds * shp, struct vm_area_struct *
                                shmd->vm_flags & VM_READ ? 'r' : '-',
                                shmd->vm_flags & VM_WRITE ? 'w' : '-',
                                shmd->vm_flags & VM_EXEC ? 'x' : '-',
-                               shmd->vm_flags & VM_SHARED ? 's' : 'p',
+                               shmd->vm_flags & VM_MAYSHARE ? 's' : 'p',
                                shmd->vm_offset, shmd->vm_pte);
                }
                shp->attaches = NULL;
index 470bdc2ef75c75603c2c5494ee9fc3b126d12c42..be4db6a0650585207fa94e7bc5b53ab0adbaed7e 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/errno.h>
 #include <asm/segment.h>
 #include <linux/sched.h>
+#include <linux/mm.h>
 #include <linux/sem.h>
 #include <linux/msg.h>
 #include <linux/shm.h>
index 0f72c7f174c8de9c8ca1ffd098a72dcf23805aaa..fd73ad5f0a090b0df3ec75e20c8c3a4503aa80ed 100644 (file)
        $(CC) $(CFLAGS) -c $<
 
 OBJS  = sched.o dma.o fork.o exec_domain.o panic.o printk.o sys.o \
-       module.o ksyms.o exit.o signal.o itimer.o info.o time.o softirq.o \
+       module.o exit.o signal.o itimer.o info.o time.o softirq.o \
        resource.o
 
+SYMTAB_OBJS = ksyms.o
+
 all: kernel.o
 
-kernel.o: $(OBJS)
-       $(LD) -r -o kernel.o $(OBJS)
+include ../versions.mk
+
+kernel.o: $(SYMTAB_OBJS) $(OBJS)
+       $(LD) -r -o kernel.o $(SYMTAB_OBJS) $(OBJS)
        sync
 
 sched.o: sched.c
index c80423314278674b780170c27f3634d7c908c4de..7f0114a46fc6017e609eab08a583c3091bd209e0 100644 (file)
@@ -1,7 +1,7 @@
 #include <linux/personality.h>
 #include <linux/ptrace.h>
 #include <linux/sched.h>
-
+#include <linux/mm.h>
 
 static asmlinkage void no_lcall7(struct pt_regs * regs);
 
index 4d5fa0f671161cbac6dbd93b59d74cd1ebc4a7f5..02f7b7ce823d509bb973464efe231bf31afd144d 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/time.h>
+#include <linux/mm.h>
 
 #include <asm/segment.h>
 
index 1d2b4e148146960ffbd8a2de2473540517e8e7bc..d9157b924bb77a7a766b86e5e1eeff864cc399ce 100644 (file)
@@ -3,11 +3,14 @@
  * with dynamically loaded kernel modules.
  *                     Jon.
  *
- * Stacked module support and unified symbol table added by
- * Bjorn Ekwall <bj0rn@blox.se>
+ * - Stacked module support and unified symbol table added (June 1994)
+ * - External symbol table support added (December 1994)
+ * - Versions on symbols added (December 1994)
+ * by Bjorn Ekwall <bj0rn@blox.se>
  */
 
 #include <linux/autoconf.h>
+#include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/fs.h>
 #include <linux/blkdev.h>
@@ -22,7 +25,6 @@
 #include <linux/timer.h>
 #include <linux/binfmts.h>
 #include <linux/personality.h>
-#include <linux/module.h>
 #include <linux/termios.h>
 #include <linux/tqueue.h>
 #include <linux/tty.h>
@@ -50,9 +52,6 @@ extern struct file_operations * get_blkfops(unsigned int);
   
 extern void *sys_call_table;
 
-/* must match struct internal_symbol !!! */
-#define X(name)        { (void *) &name, "_" #name }
-
 #ifdef CONFIG_FTAPE
 extern char * ftape_big_buffer;
 extern void (*do_floppy)(void);
@@ -69,20 +68,24 @@ extern void free_dma(unsigned int dmanr);
 
 extern void (* iABI_hook)(struct pt_regs * regs);
 
-struct symbol_table symbol_table = { 0, 0, 0, /* for stacked module support */
-       {
+struct symbol_table symbol_table = {
+#include <linux/symtab_begin.h>
+#ifdef CONFIG_MODVERSIONS
+       { (void *)1 /* Version version :-) */, "_Using_Versions" },
+#endif
        /* stackable module support */
        X(rename_module_symbol),
+       X(register_symtab),
 
        /* system info variables */
        /* These check that they aren't defines (0/1) */
-#ifndef EISA_bus
+#ifndef EISA_bus__is_a_macro
        X(EISA_bus),
 #endif
-#ifndef MCA_bus
+#ifndef MCA_bus__is_a_macro
        X(MCA_bus),
 #endif
-#ifndef wp_works_ok
+#ifndef wp_works_ok__is_a_macro
        X(wp_works_ok),
 #endif
 
@@ -329,9 +332,7 @@ struct symbol_table symbol_table = { 0, 0, 0, /* for stacked module support */
         * Do not add anything below this line,
         * as the stacked modules depend on this!
         */
-       { NULL, NULL } /* mark end of table */
-       },
-       { { NULL, NULL } /* no module refs */ }
+#include <linux/symtab_end.h>
 };
 
 /*
index 6f26bea88fef1827d81dc48b97f26ea34c15d9d9..85bb08b03d0b126aa925aaf95d1ab9bf7dd9e22a 100644 (file)
  *     - Supports redefines of all symbols, for streams-like behaviour.
  *     - Compatible with older versions of insmod.
  *
+ * New addition in December 1994: (Bjorn Ekwall, idea from Jacques Gelinas)
+ *     - Externally callable function:
+ *
+ *             "int register_symtab(struct symbol_table *)"
+ *
+ *       This function can be called from within the kernel,
+ *       and ALSO from loadable modules.
+ *       The goal is to assist in modularizing the kernel even more,
+ *       and finally: reducing the number of entries in ksyms.c
+ *       since every subsystem should now be able to decide amd
+ *       control exactly what symbols it wants to export, locally!
  */
 
 #ifdef DEBUG_MODULE
@@ -40,6 +51,7 @@ static struct module *find_module( const char *name);
 static int get_mod_name( char *user_name, char *buf);
 static int free_modules( void);
 
+static int module_init_flag = 0; /* Hmm... */
 
 /*
  * Called at boot time
@@ -285,8 +297,12 @@ sys_init_module(char *module_name, char *code, unsigned codesize,
                }
        }
 
-       if ((*rt.init)() != 0)
+       module_init_flag = 1; /* Hmm... */
+       if ((*rt.init)() != 0) {
+               module_init_flag = 0; /* Hmm... */
                return -EBUSY;
+       }
+       module_init_flag = 0; /* Hmm... */
        mp->state = MOD_RUNNING;
 
        return 0;
@@ -354,6 +370,9 @@ sys_get_kernel_syms(struct kernel_sym *table)
                        /* include the count for the module name! */
                        nmodsyms += mp->symtab->n_symbols + 1;
                }
+               else
+                       /* include the count for the module name! */
+                       nmodsyms += 1; /* return modules without symbols too */
        }
 
        if (table != NULL) {
@@ -364,21 +383,22 @@ sys_get_kernel_syms(struct kernel_sym *table)
 
                /* copy all module symbols first (always LIFO order) */
                for (mp = module_list; mp; mp = mp->next) {
-                       if ((mp->state == MOD_RUNNING) &&
-                               (mp->symtab != NULL) && (mp->symtab->n_symbols > 0)) {
+                       if (mp->state == MOD_RUNNING) {
                                /* magic: write module info as a pseudo symbol */
                                isym.value = (unsigned long)mp;
                                sprintf(isym.name, "#%s", mp->name);
                                memcpy_tofs(to, &isym, sizeof isym);
                                ++to;
 
-                               for (i = mp->symtab->n_symbols,
-                                       from = mp->symtab->symbol;
-                                       i > 0; --i, ++from, ++to) {
+                               if (mp->symtab != NULL) {
+                                       for (i = mp->symtab->n_symbols,
+                                               from = mp->symtab->symbol;
+                                               i > 0; --i, ++from, ++to) {
 
-                                       isym.value = (unsigned long)from->addr;
-                                       strncpy(isym.name, from->name, sizeof isym.name);
-                                       memcpy_tofs(to, &isym, sizeof isym);
+                                               isym.value = (unsigned long)from->addr;
+                                               strncpy(isym.name, from->name, sizeof isym.name);
+                                               memcpy_tofs(to, &isym, sizeof isym);
+                                       }
                                }
                        }
                }
@@ -582,3 +602,160 @@ int get_ksyms_list(char *buf)
 
        return p - buf;
 }
+
+/*
+ * Rules:
+ * - The new symbol table should be statically allocated, or else you _have_
+ *   to set the "size" field of the struct to the number of bytes allocated.
+ *
+ * - The strings that name the symbols will not be copied, maybe the pointers
+ *
+ * - For a loadable module, the function should only be called in the
+ *   context of init_module
+ *
+ * Those are the only restrictions! (apart from not being reenterable...)
+ *
+ * If you want to remove a symbol table for a loadable module,
+ * the call looks like: "register_symtab(0)".
+ *
+ * The look of the code is mostly dictated by the format of
+ * the frozen struct symbol_table, due to compatibility demands.
+ */
+#define INTSIZ sizeof(struct internal_symbol)
+#define REFSIZ sizeof(struct module_ref)
+#define SYMSIZ sizeof(struct symbol_table)
+#define MODSIZ sizeof(struct module)
+static struct symbol_table nulltab;
+
+int
+register_symtab(struct symbol_table *intab)
+{
+       struct module *mp;
+       struct module *link;
+       struct symbol_table *oldtab;
+       struct symbol_table *newtab;
+       struct module_ref *newref;
+       int size;
+
+       if (intab && (intab->n_symbols == 0)) {
+               struct internal_symbol *sym;
+               /* How many symbols, really? */
+
+               for (sym = intab->symbol; sym->name; ++sym)
+                       intab->n_symbols +=1;
+       }
+
+#if 1
+       if (module_init_flag == 0) { /* Hmm... */
+#else
+       if (module_list == &kernel_module) {
+#endif
+               /* Aha! Called from an "internal" module */
+               if (!intab)
+                       return 0; /* or -ESILLY_PROGRAMMER :-) */
+
+               /* create a pseudo module! */
+               if (!(mp = (struct module*) kmalloc(MODSIZ, GFP_KERNEL))) {
+                       /* panic time! */
+                       printk("Out of memory for new symbol table!\n");
+                       return -ENOMEM;
+               }
+               /* else  OK */
+               memset(mp, 0, MODSIZ);
+               mp->state = MOD_RUNNING; /* Since it is resident... */
+               mp->name = ""; /* This is still the "kernel" symbol table! */
+               mp->symtab = intab;
+
+               /* link it in _after_ the resident symbol table */
+               mp->next = kernel_module.next;
+               kernel_module.next = mp;
+
+               return 0;
+       }
+
+       /* else ******** Called from a loadable module **********/
+
+       /*
+        * This call should _only_ be done in the context of the
+        * call to  init_module  i.e. when loading the module!!
+        * Or else...
+        */
+       mp = module_list; /* true when doing init_module! */
+
+       /* Any table there before? */
+       if ((oldtab = mp->symtab) == (struct symbol_table*)0) {
+               /* No, just insert it! */
+               mp->symtab = intab;
+               return 0;
+       }
+
+       /* else  ****** we have to replace the module symbol table ******/
+#if 0
+       if (oldtab->n_symbols > 0) {
+               /* Oh dear, I have to drop the old ones... */
+               printk("Warning, dropping old symbols\n");
+       }
+#endif
+
+       if (oldtab->n_refs == 0) { /* no problems! */
+               mp->symtab = intab;
+               /* if the old table was kmalloc-ed, drop it */
+               if (oldtab->size > 0)
+                       kfree_s(oldtab, oldtab->size);
+
+               return 0;
+       }
+
+       /* else */
+       /***** The module references other modules... insmod said so! *****/
+       /* We have to allocate a new symbol table, or we lose them! */
+       if (intab == (struct symbol_table*)0)
+               intab = &nulltab; /* easier code with zeroes in place */
+
+       /* the input symbol table space does not include the string table */
+       /* (it does for symbol tables that insmod creates) */
+
+       if (!(newtab = (struct symbol_table*)kmalloc(
+               size = SYMSIZ + intab->n_symbols * INTSIZ +
+                       oldtab->n_refs * REFSIZ,
+               GFP_KERNEL))) {
+               /* panic time! */
+               printk("Out of memory for new symbol table!\n");
+               return -ENOMEM;
+       }
+
+       /* copy up to, and including, the new symbols */
+       memcpy(newtab, intab, SYMSIZ + intab->n_symbols * INTSIZ);
+
+       newtab->size = size;
+       newtab->n_refs = oldtab->n_refs;
+
+       /* copy references */
+       memcpy( ((char *)newtab) + SYMSIZ + intab->n_symbols * INTSIZ,
+               ((char *)oldtab) + SYMSIZ + oldtab->n_symbols * INTSIZ,
+               oldtab->n_refs * REFSIZ);
+
+       /* relink references from the old table to the new one */
+
+       /* pointer to the first reference entry in newtab! Really! */
+       newref = (struct module_ref*) &(newtab->symbol[newtab->n_symbols]);
+
+       /* check for reference links from previous modules */
+       for (   link = module_list;
+               link && (link != &kernel_module);
+               link = link->next) {
+
+               if (link->ref->module == mp)
+                       link->ref = newref++;
+       }
+
+       mp->symtab = newtab;
+
+       /* all references (if any) have been handled */
+
+       /* if the old table was kmalloc-ed, drop it */
+       if (oldtab->size > 0)
+               kfree_s(oldtab, oldtab->size);
+
+       return 0;
+}
index 7a1f6de89df012b1e159e9cddeea03158d2d84b2..8b518f6cbf8804e5427cf82d08fd2802ef012e20 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
+#include <linux/mm.h>
 
 #define LOG_BUF_LEN    4096
 
index 61a69a5e0a634a7fe6e4b0a0493060e5637ca142..511f3195c43521c92a8bc1c0e12be2e489b38a94 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/interrupt.h>
 #include <linux/tqueue.h>
 #include <linux/resource.h>
+#include <linux/mm.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
index cd8fa6583934701c037f518036cd2e4f0249d7e3..f21d7a2c99a631c29b231eb11fd627142af22e4d 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/wait.h>
 #include <linux/ptrace.h>
 #include <linux/unistd.h>
+#include <linux/mm.h>
 
 #include <asm/segment.h>
 
index 81f168056a68bd497ba7507cbaf523cb0fb34c2a..709e64b5d905b014d5adf7b4c070ce80ce0a1b47 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/signal.h>
 #include <linux/sched.h>
 #include <linux/interrupt.h>
+#include <linux/mm.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
index 9480f0aba8c3dde1197070940ef6ca1f0a31914d..834751574d2cd4a4c3fd1bd3cd0a7e666361365b 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/kernel.h>
 #include <linux/param.h>
 #include <linux/string.h>
+#include <linux/mm.h>
 
 #include <asm/segment.h>
 #include <asm/io.h>
index deb3f33c7501fc4ff803c3dee8b6b75a239d4658..92036612cbdd5a72bd8e5f43ef8742df4202a57c 100644 (file)
@@ -43,6 +43,7 @@
 #include <linux/types.h>
 #include <linux/ptrace.h>
 #include <linux/mman.h>
+#include <linux/mm.h>
 
 #include <asm/system.h>
 #include <asm/segment.h>
@@ -192,10 +193,10 @@ void free_page_tables(struct task_struct * tsk)
  */
 int clone_page_tables(struct task_struct * tsk)
 {
-       unsigned long pg_dir;
+       pgd_t * pg_dir;
 
-       pg_dir = (unsigned long) PAGE_DIR_OFFSET(current, 0);
-       mem_map[MAP_NR(pg_dir)]++;
+       pg_dir = PAGE_DIR_OFFSET(current, 0);
+       mem_map[MAP_NR((unsigned long) pg_dir)]++;
        SET_PAGE_DIR(tsk, pg_dir);
        return 0;
 }
index 16e9687475f1e980578d1baeb9b459f4232f58c1..5285c3fc40302cec2c5e4e1b7948cde0d712097e 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -121,8 +121,18 @@ int do_mmap(struct file * file, unsigned long addr, unsigned long len,
                        vma->vm_flags |= VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC;
                if (flags & MAP_SHARED) {
                        vma->vm_flags |= VM_SHARED | VM_MAYSHARE;
+                       /*
+                        * This looks strange, but when we don't have the file open
+                        * for writing, we can demote the shared mapping to a simpler
+                        * private mapping. That also takes care of a security hole
+                        * with ptrace() writing to a shared mapping without write
+                        * permissions.
+                        *
+                        * We leave the VM_MAYSHARE bit on, just to get correct output
+                        * from /proc/xxx/maps..
+                        */
                        if (!(file->f_mode & 2))
-                               vma->vm_flags &= ~VM_MAYWRITE;
+                               vma->vm_flags &= ~(VM_MAYWRITE | VM_SHARED);
                }
        } else
                vma->vm_flags |= VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC;
index f159c6e2fa606263fb1a6d6c3afabcd4d430d365..6fbe505acd4d374cb1fb9547f590180e8a93d5e7 100644 (file)
@@ -153,7 +153,7 @@ static int mprotect_fixup(struct vm_area_struct * vma,
 
        if (newflags == vma->vm_flags)
                return 0;
-       newprot = protection_map[vma->vm_flags & 0xf];
+       newprot = protection_map[newflags & 0xf];
        if (start == vma->vm_start)
                if (end == vma->vm_end)
                        error = mprotect_fixup_all(vma, newflags, newprot);
index a15ea3bcc4062852844ea46b3e99bb276a7736b2..5dbbd47c35352aeb7c6ecb7686f04706dd40e835 100644 (file)
@@ -13,6 +13,8 @@
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/malloc.h>
+#include <linux/mm.h>
+
 #include <asm/segment.h>
 
 struct vm_struct {
@@ -24,15 +26,6 @@ struct vm_struct {
 
 static struct vm_struct * vmlist = NULL;
 
-/* Just any arbitrary offset to the start of the vmalloc VM area: the
- * current 8MB value just means that there will be a 8MB "hole" after the
- * physical memory until the kernel virtual memory starts.  That means that
- * any out-of-bounds memory accesses will hopefully be caught.
- * The vmalloc() routines leaves a hole of 4kB between each vmalloced
- * area for the same reason. ;)
- */
-#define VMALLOC_OFFSET (8*1024*1024)
-
 static inline void set_pgdir(unsigned long dindex, pte_t * page_table)
 {
        struct task_struct * p;
@@ -135,8 +128,9 @@ static int do_area(void * addr, unsigned long size,
        unsigned long nr, dindex, index;
 
        nr = size >> PAGE_SHIFT;
-       dindex = (TASK_SIZE + (unsigned long) addr) >> 22;
-       index = (((unsigned long) addr) >> PAGE_SHIFT) & (PTRS_PER_PAGE-1);
+       dindex = VMALLOC_VMADDR(addr);
+       index = (dindex >> PAGE_SHIFT) & (PTRS_PER_PAGE-1);
+       dindex = (dindex >> PGDIR_SHIFT) & (PTRS_PER_PAGE-1);
        while (nr > 0) {
                unsigned long i = PTRS_PER_PAGE - index;
 
@@ -183,7 +177,7 @@ void * vmalloc(unsigned long size)
        area = (struct vm_struct *) kmalloc(sizeof(*area), GFP_KERNEL);
        if (!area)
                return NULL;
-       addr = (void *) ((high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1));
+       addr = (void *) VMALLOC_START;
        area->size = size + PAGE_SIZE;
        area->next = NULL;
        for (p = &vmlist; (tmp = *p) ; p = &tmp->next) {
diff --git a/modules/NET_MODULES b/modules/NET_MODULES
deleted file mode 100644 (file)
index 89c6187..0000000
+++ /dev/null
@@ -1 +0,0 @@
-3c509.o de600.o de620.o 3c501.o apricot.o eexpress.o plip.o 8390.o slip.o slhc.o dummy.o ewrk3.o depca.o
index cedea00cb474a4d9ce9582fddf07a0fd8fda9a49..0bfa44e68b4a30368565dd36f06982ca85da5d52 100644 (file)
@@ -49,6 +49,7 @@
 #include <linux/errno.h>
 #include <linux/if_arp.h>
 #include <linux/in.h>
+#include <linux/mm.h>
 #include <asm/system.h>
 #include <asm/segment.h>
 #include <stdarg.h>
index 46990ae5a3eb05772c6889d0a9122efb43b35775..623190e54bae8d8b18ec03a0da0b57cd71aa9e3e 100644 (file)
@@ -63,6 +63,8 @@
  *             Alan Cox        :       Multicast loopback error for 224.0.0.1
  *             Alan Cox        :       IP_MULTICAST_LOOP option.
  *             Alan Cox        :       Use notifiers.
+ *             Bjorn Ekwall    :       Removed ip_csum (from slhc.c too)
+ *             Bjorn Ekwall    :       Moved ip_fast_csum to ip.h (inline!)
  *
  * To Fix:
  *             IP option processing is mostly not needed. ip_forward needs to know about routing rules
@@ -86,6 +88,7 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
+#include <linux/mm.h>
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/config.h>
@@ -487,35 +490,6 @@ do_options(struct iphdr *iph, struct options *opt)
   return(0);
 }
 
-/*
- *     This is a version of ip_compute_csum() optimized for IP headers, which
- *     always checksum on 4 octet boundaries.
- */
-
-static inline unsigned short ip_fast_csum(unsigned char * buff, int wlen)
-{
-       unsigned long sum = 0;
-
-       if (wlen)
-       {
-       unsigned long bogus;
-        __asm__("clc\n"
-               "1:\t"
-               "lodsl\n\t"
-               "adcl %3, %0\n\t"
-               "decl %2\n\t"
-               "jne 1b\n\t"
-               "adcl $0, %0\n\t"
-               "movl %0, %3\n\t"
-               "shrl $16, %3\n\t"
-               "addw %w3, %w0\n\t"
-               "adcw $0, %w0"
-           : "=r" (sum), "=S" (buff), "=r" (wlen), "=a" (bogus)
-           : "0"  (sum),  "1" (buff),  "2" (wlen));
-       }
-       return (~sum) & 0xffff;
-}
-
 /*
  * This routine does all the checksum computations that don't
  * require anything special (like copying or special headers).
@@ -565,15 +539,6 @@ unsigned short ip_compute_csum(unsigned char * buff, int len)
        return(sum & 0xffff);
 }
 
-/*
- *     Check the header of an incoming IP datagram.  This version is still used in slhc.c.
- */
-
-int ip_csum(struct iphdr *iph)
-{
-       return ip_fast_csum((unsigned char *)iph, iph->ihl);
-}
-
 /*
  *     Generate a checksum for an outgoing IP datagram.
  */
index 2ba95d772fdfad67fd40d7e0a9dfd5d39d1f5a28..95954a8c3814f195794b60a50318eb6cdd83c8d9 100644 (file)
@@ -96,4 +96,35 @@ extern int           ip_getsockopt(struct sock *sk, int level, int optname, char *optval
 extern void            ip_init(void);
 
 extern struct ip_mib   ip_statistics;
+
+/*
+ *     This is a version of ip_compute_csum() optimized for IP headers, which
+ *     always checksum on 4 octet boundaries.
+ *     Used by ip.c and slhc.c (the net driver module)
+ *     (Moved to here by bj0rn@blox.se)
+ */
+
+static inline unsigned short ip_fast_csum(unsigned char * buff, int wlen)
+{
+       unsigned long sum = 0;
+
+       if (wlen)
+       {
+       unsigned long bogus;
+        __asm__("clc\n"
+               "1:\t"
+               "lodsl\n\t"
+               "adcl %3, %0\n\t"
+               "decl %2\n\t"
+               "jne 1b\n\t"
+               "adcl $0, %0\n\t"
+               "movl %0, %3\n\t"
+               "shrl $16, %3\n\t"
+               "addw %w3, %w0\n\t"
+               "adcw $0, %w0"
+           : "=r" (sum), "=S" (buff), "=r" (wlen), "=a" (bogus)
+           : "0"  (sum),  "1" (buff),  "2" (wlen));
+       }
+       return (~sum) & 0xffff;
+}
 #endif /* _IP_H */
index 3ddc1c3ea8dc6433b6e5a0cf14f912d6b6072feb..ab031c81ae2e4dfed0faa6019123e259cde85929 100644 (file)
@@ -37,6 +37,7 @@
  
 #include <linux/types.h>
 #include <linux/sched.h>
+#include <linux/mm.h>
 #include <linux/fcntl.h>
 #include <linux/socket.h>
 #include <linux/in.h>
index 94db10cf89e5b572c1eeb3b9207862c7e2054735..5d2c8c04170b0e6b2105f2392e9a414ef27b22d2 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/string.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
+#include <linux/mm.h>
 #include <linux/config.h>
 #include <linux/socket.h>
 #include <linux/sockios.h>
index e2aa3aeb2d952986ea34d2f2107a0fad524781df..5e119b6923a26046e1053a3b492afe32dffd8e50 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
+#include <linux/mm.h>
 #include <linux/string.h>
 #include <linux/socket.h>
 #include <linux/sockios.h>
index 0ebf815f247793d90258e58230dfc9f1eee08c26..ef241aa2e2e3df9fba59c93ff8b14feaee8dea21 100644 (file)
@@ -49,6 +49,7 @@
 #include <linux/signal.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
+#include <linux/mm.h>
 #include <linux/kernel.h>
 #include <linux/major.h>
 #include <linux/stat.h>
diff --git a/versions.mk b/versions.mk
new file mode 100644 (file)
index 0000000..2f72222
--- /dev/null
@@ -0,0 +1,28 @@
+ifdef CONFIG_MODVERSIONS
+TOPINCL := $(TOPDIR)/include/linux
+
+# Uses SYMTAB_OBJS
+# Separate the object into "normal" objects and "exporting" objects
+# Exporting objects are: all objects that define symbol tables
+#
+# Add dependence on $(SYMTAB_OBJS) to the main target
+#
+
+.SUFFIXES: .ver
+
+.c.ver:
+       $(CC) $(CFLAGS) -E -D__GENKSYMS__ $< | genksyms -w $(TOPINCL)/modules
+       @ln -sf $(TOPINCL)/modules/$@ .
+
+$(SYMTAB_OBJS):
+       $(CC) $(CFLAGS) -DEXPORT_SYMTAB -c $(@:.o=.c)
+
+$(TOPINCL)/modversions.h: $(SYMTAB_OBJS:.o=.ver)
+       @echo updating $(TOPINCL)/modversions.h
+       @(cd $(TOPINCL)/modules; for f in *.ver;\
+       do echo "#include <linux/modules/$${f}>"; done) \
+       > $(TOPINCL)/modversions.h
+
+dep: $(TOPINCL)/modversions.h
+
+endif