diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-04-28 01:09:25 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-04-28 01:09:25 +0000 |
commit | b9ba7aeb165cffecdffb60aec8c3fa8d590d9ca9 (patch) | |
tree | 42d07b0c7246ae2536a702e7c5de9e2732341116 /arch/sparc64/kernel | |
parent | 7406b0a326f2d70ade2671c37d1beef62249db97 (diff) |
Merge with 2.3.99-pre6.
Diffstat (limited to 'arch/sparc64/kernel')
-rw-r--r-- | arch/sparc64/kernel/Makefile | 2 | ||||
-rw-r--r-- | arch/sparc64/kernel/binfmt_aout32.c | 20 | ||||
-rw-r--r-- | arch/sparc64/kernel/ioctl32.c | 8 | ||||
-rw-r--r-- | arch/sparc64/kernel/irq.c | 109 | ||||
-rw-r--r-- | arch/sparc64/kernel/pci_common.c | 85 | ||||
-rw-r--r-- | arch/sparc64/kernel/pci_psycho.c | 24 | ||||
-rw-r--r-- | arch/sparc64/kernel/pci_sabre.c | 48 | ||||
-rw-r--r-- | arch/sparc64/kernel/power.c | 5 | ||||
-rw-r--r-- | arch/sparc64/kernel/process.c | 7 | ||||
-rw-r--r-- | arch/sparc64/kernel/ptrace.c | 10 | ||||
-rw-r--r-- | arch/sparc64/kernel/sbus.c | 16 | ||||
-rw-r--r-- | arch/sparc64/kernel/signal.c | 2 | ||||
-rw-r--r-- | arch/sparc64/kernel/signal32.c | 8 | ||||
-rw-r--r-- | arch/sparc64/kernel/smp.c | 61 | ||||
-rw-r--r-- | arch/sparc64/kernel/sparc64_ksyms.c | 14 | ||||
-rw-r--r-- | arch/sparc64/kernel/sys_sparc.c | 32 | ||||
-rw-r--r-- | arch/sparc64/kernel/sys_sparc32.c | 93 | ||||
-rw-r--r-- | arch/sparc64/kernel/sys_sunos32.c | 18 | ||||
-rw-r--r-- | arch/sparc64/kernel/systbls.S | 10 | ||||
-rw-r--r-- | arch/sparc64/kernel/time.c | 34 |
20 files changed, 360 insertions, 246 deletions
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile index 5e37c94b4..5c0d38d0d 100644 --- a/arch/sparc64/kernel/Makefile +++ b/arch/sparc64/kernel/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.52 2000/03/19 07:00:29 ecd Exp $ +# $Id: Makefile,v 1.53 2000/03/31 04:06:22 davem Exp $ # Makefile for the linux kernel. # # Note! Dependencies are done automagically by 'make dep', which also diff --git a/arch/sparc64/kernel/binfmt_aout32.c b/arch/sparc64/kernel/binfmt_aout32.c index c72f7272f..9cc240293 100644 --- a/arch/sparc64/kernel/binfmt_aout32.c +++ b/arch/sparc64/kernel/binfmt_aout32.c @@ -198,7 +198,6 @@ static u32 *create_aout32_tables(char * p, struct linux_binprm * bprm) static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) { struct exec ex; - int fd; unsigned long error; unsigned long fd_offset; unsigned long rlim; @@ -230,7 +229,7 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) return retval; /* OK, This is the point of no return */ - current->personality = PER_LINUX; + set_personality(PER_SUNOS); current->mm->end_code = ex.a_text + (current->mm->start_code = N_TXTADDR(ex)); @@ -270,15 +269,8 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) error_time = jiffies; } - fd = get_unused_fd(); - if (fd < 0) - return fd; - get_file(bprm->file); - fd_install(fd, bprm->file); - if (!bprm->file->f_op->mmap) { loff_t pos = fd_offset; - sys_close(fd); do_brk(0, ex.a_text+ex.a_data); bprm->file->f_op->read(bprm->file,(char *)N_TXTADDR(ex), ex.a_text+ex.a_data, &pos); @@ -291,7 +283,6 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) fd_offset); if (error != N_TXTADDR(ex)) { - sys_close(fd); send_sig(SIGKILL, current, 0); return error; } @@ -300,20 +291,13 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs) PROT_READ | PROT_WRITE | PROT_EXEC, MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE | MAP_EXECUTABLE, fd_offset + ex.a_text); - sys_close(fd); if (error != N_DATADDR(ex)) { send_sig(SIGKILL, current, 0); return error; } } beyond_if: - put_exec_domain(current->exec_domain); - if (current->binfmt && current->binfmt->module) - __MOD_DEC_USE_COUNT(current->binfmt->module); - current->exec_domain = lookup_exec_domain(current->personality); - current->binfmt = &aout32_format; - if (current->binfmt && current->binfmt->module) - __MOD_INC_USE_COUNT(current->binfmt->module); + set_binfmt(&aout32_format); set_brk(current->mm->start_brk, current->mm->brk); diff --git a/arch/sparc64/kernel/ioctl32.c b/arch/sparc64/kernel/ioctl32.c index ef07fca85..c7e2fecfb 100644 --- a/arch/sparc64/kernel/ioctl32.c +++ b/arch/sparc64/kernel/ioctl32.c @@ -1,4 +1,4 @@ -/* $Id: ioctl32.c,v 1.87 2000/03/30 02:09:07 davem Exp $ +/* $Id: ioctl32.c,v 1.88 2000/04/14 10:10:34 davem Exp $ * ioctl32.c: Conversion between 32bit and 64bit native ioctls. * * Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com) @@ -1816,6 +1816,7 @@ struct atm_iobuf32 { #define ATM_GETSTATZ32 _IOW('a', ATMIOC_SARCOM+1, struct atmif_sioc32) #define ATM_GETLOOP32 _IOW('a', ATMIOC_SARCOM+2, struct atmif_sioc32) #define ATM_SETLOOP32 _IOW('a', ATMIOC_SARCOM+3, struct atmif_sioc32) +#define ATM_QUERYLOOP32 _IOW('a', ATMIOC_SARCOM+4, struct atmif_sioc32) static struct { unsigned int cmd32; @@ -1836,7 +1837,8 @@ static struct { { ATM_GETSTAT32, ATM_GETSTAT }, { ATM_GETSTATZ32, ATM_GETSTATZ }, { ATM_GETLOOP32, ATM_GETLOOP }, - { ATM_SETLOOP32, ATM_SETLOOP } + { ATM_SETLOOP32, ATM_SETLOOP }, + { ATM_QUERYLOOP32, ATM_QUERYLOOP } }; #define NR_ATM_IOCTL (sizeof(atm_ioctl_map)/sizeof(atm_ioctl_map[0])) @@ -1996,6 +1998,7 @@ static int do_atm_ioctl(unsigned int fd, unsigned int cmd32, unsigned long arg) case ATM_GETSTATZ: case ATM_GETLOOP: case ATM_SETLOOP: + case ATM_QUERYLOOP: return do_atmif_sioc(fd, cmd, arg); } @@ -3110,6 +3113,7 @@ HANDLE_IOCTL(ATM_GETSTAT32, do_atm_ioctl) HANDLE_IOCTL(ATM_GETSTATZ32, do_atm_ioctl) HANDLE_IOCTL(ATM_GETLOOP32, do_atm_ioctl) HANDLE_IOCTL(ATM_SETLOOP32, do_atm_ioctl) +HANDLE_IOCTL(ATM_QUERYLOOP32, do_atm_ioctl) HANDLE_IOCTL(SONET_GETSTAT, do_atm_ioctl) HANDLE_IOCTL(SONET_GETSTATZ, do_atm_ioctl) HANDLE_IOCTL(SONET_GETDIAG, do_atm_ioctl) diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c index d2bc6baf5..6bb01d4c1 100644 --- a/arch/sparc64/kernel/irq.c +++ b/arch/sparc64/kernel/irq.c @@ -1,4 +1,4 @@ -/* $Id: irq.c,v 1.85 2000/03/02 02:00:24 davem Exp $ +/* $Id: irq.c,v 1.86 2000/04/15 06:02:50 davem Exp $ * irq.c: UltraSparc IRQ handling/init/registry. * * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) @@ -538,82 +538,43 @@ out: } /* Only uniprocessor needs this IRQ/BH locking depth, on SMP it - * lives in the per-cpu structure for cache reasons. + * lives in the brlock table for cache reasons. */ #ifndef __SMP__ unsigned int local_irq_count; unsigned int local_bh_count; - -#define irq_enter(cpu, irq) (local_irq_count++) -#define irq_exit(cpu, irq) (local_irq_count--) #else /* Who has global_irq_lock. */ unsigned char global_irq_holder = NO_PROC_ID; -/* This protects IRQ's. */ -spinlock_t global_irq_lock = SPIN_LOCK_UNLOCKED; - -/* Global IRQ locking depth. */ -atomic_t global_irq_count = ATOMIC_INIT(0); - -#define irq_enter(cpu, irq) \ -do { hardirq_enter(cpu); \ - spin_unlock_wait(&global_irq_lock); \ -} while(0) -#define irq_exit(cpu, irq) hardirq_exit(cpu) - static void show(char * str) { int cpu = smp_processor_id(); + int i; printk("\n%s, CPU %d:\n", str, cpu); - printk("irq: %d [%u %u]\n", - atomic_read(&global_irq_count), - cpu_data[0].irq_count, cpu_data[1].irq_count); - printk("bh: %d [%u %u]\n", - (spin_is_locked(&global_bh_lock) ? 1 : 0), - cpu_data[0].bh_count, cpu_data[1].bh_count); + printk("irq: %d [ ", irqs_running()); + for (i = 0; i < smp_num_cpus; i++) + printk("%u ", __brlock_array[i][BR_GLOBALIRQ_LOCK]); + printk("]\nbh: %d [ ", + (spin_is_locked(&global_bh_lock) ? 1 : 0)); + for (i = 0; i < smp_num_cpus; i++) + printk("%u ", cpu_data[i].bh_count); + printk("]\n"); } #define MAXCOUNT 100000000 +#if 0 #define SYNC_OTHER_ULTRAS(x) udelay(x+1) - -static inline void wait_on_irq(int cpu) -{ - int count = MAXCOUNT; - for(;;) { - membar("#LoadLoad"); - if (!atomic_read (&global_irq_count)) { - if (local_bh_count || ! spin_is_locked(&global_bh_lock)) - break; - } - spin_unlock (&global_irq_lock); - membar("#StoreLoad | #StoreStore"); - for(;;) { - if (!--count) { - show("wait_on_irq"); - count = ~0; - } - __sti(); - SYNC_OTHER_ULTRAS(cpu); - __cli(); - if (atomic_read(&global_irq_count)) - continue; - if (spin_is_locked (&global_irq_lock)) - continue; - if (!local_bh_count && spin_is_locked (&global_bh_lock)) - continue; - if (spin_trylock(&global_irq_lock)) - break; - } - } -} +#else +#define SYNC_OTHER_ULTRAS(x) membar("#Sync"); +#endif void synchronize_irq(void) { - if (atomic_read(&global_irq_count)) { + if (irqs_running()) { cli(); sti(); } @@ -621,15 +582,37 @@ void synchronize_irq(void) static inline void get_irqlock(int cpu) { - if (! spin_trylock(&global_irq_lock)) { - if ((unsigned char) cpu == global_irq_holder) - return; - do { - while (spin_is_locked (&global_irq_lock)) - membar("#LoadLoad"); - } while(! spin_trylock(&global_irq_lock)); + int count; + + if ((unsigned char)cpu == global_irq_holder) + return; + + count = MAXCOUNT; +again: + br_write_lock(BR_GLOBALIRQ_LOCK); + for (;;) { + spinlock_t *lock; + + if (!irqs_running() && + (local_bh_count || !spin_is_locked(&global_bh_lock))) + break; + + br_write_unlock(BR_GLOBALIRQ_LOCK); + lock = &__br_write_locks[BR_GLOBALIRQ_LOCK].lock; + while (irqs_running() || + spin_is_locked(lock) || + (!local_bh_count && spin_is_locked(&global_bh_lock))) { + if (!--count) { + show("wait_on_irq"); + count = (~0 >> 1); + } + __sti(); + SYNC_OTHER_ULTRAS(cpu); + __cli(); + } + goto again; } - wait_on_irq(cpu); + global_irq_holder = cpu; } diff --git a/arch/sparc64/kernel/pci_common.c b/arch/sparc64/kernel/pci_common.c index 98b41d079..5cd905244 100644 --- a/arch/sparc64/kernel/pci_common.c +++ b/arch/sparc64/kernel/pci_common.c @@ -1,4 +1,4 @@ -/* $Id: pci_common.c,v 1.7 2000/03/25 05:18:11 davem Exp $ +/* $Id: pci_common.c,v 1.11 2000/04/26 10:48:02 davem Exp $ * pci_common.c: PCI controller common support. * * Copyright (C) 1999 David S. Miller (davem@redhat.com) @@ -66,6 +66,27 @@ static void pci_device_delete(struct pci_dev *pdev) kfree(pdev); } +/* Older versions of OBP on PCI systems encode 64-bit MEM + * space assignments incorrectly, this fixes them up. + */ +static void __init fixup_obp_assignments(struct pcidev_cookie *pcp) +{ + int i; + + for (i = 0; i < pcp->num_prom_assignments; i++) { + struct linux_prom_pci_registers *ap; + int space; + + ap = &pcp->prom_assignments[i]; + space = ap->phys_hi >> 24; + if ((space & 0x3) == 2 && + (space & 0x4) != 0) { + ap->phys_hi &= ~(0x7 << 24); + ap->phys_hi |= 0x3 << 24; + } + } +} + /* Fill in the PCI device cookie sysdata for the given * PCI device. This cookie is the means by which one * can get to OBP and PCI controller specific information @@ -147,6 +168,8 @@ static void __init pdev_cookie_fillin(struct pci_pbm_info *pbm, (err / sizeof(pcp->prom_assignments[0])); } + fixup_obp_assignments(pcp); + pdev->sysdata = pcp; } @@ -219,10 +242,15 @@ __init get_root_resource(struct linux_prom_pci_registers *ap, return &pbm->mem_space; case 3: + /* 64-bit MEM space, these are allocated out of + * the 32-bit mem_space range for the PBM, ie. + * we just zero out the upper 32-bits. + */ + return &pbm->mem_space; + default: - /* 64-bit MEM space, unsupported. */ - printk("PCI: 64-bit MEM assignment??? " - "Tell davem@redhat.com about it!\n"); + printk("PCI: What is resource space %x? " + "Tell davem@redhat.com about it!\n", space); return NULL; }; } @@ -231,6 +259,7 @@ static struct resource * __init get_device_resource(struct linux_prom_pci_registers *ap, struct pci_dev *pdev) { + struct resource *res; int breg = (ap->phys_hi & 0xff); int space = (ap->phys_hi >> 24) & 3; @@ -240,7 +269,8 @@ __init get_device_resource(struct linux_prom_pci_registers *ap, if (space != 2) bad_assignment(ap, NULL, 0); - return &pdev->resource[PCI_ROM_RESOURCE]; + res = &pdev->resource[PCI_ROM_RESOURCE]; + break; case PCI_BASE_ADDRESS_0: case PCI_BASE_ADDRESS_1: @@ -248,12 +278,16 @@ __init get_device_resource(struct linux_prom_pci_registers *ap, case PCI_BASE_ADDRESS_3: case PCI_BASE_ADDRESS_4: case PCI_BASE_ADDRESS_5: - return &pdev->resource[(breg - PCI_BASE_ADDRESS_0) / 4]; + res = &pdev->resource[(breg - PCI_BASE_ADDRESS_0) / 4]; + break; default: bad_assignment(ap, NULL, 0); - return NULL; + res = NULL; + break; }; + + return res; } static void __init pdev_record_assignments(struct pci_pbm_info *pbm, @@ -281,6 +315,31 @@ static void __init pdev_record_assignments(struct pci_pbm_info *pbm, if ((res->start & 0xffffffffUL) != ap->phys_lo) bad_assignment(ap, res, 1); + /* If it is a 64-bit MEM space assignment, verify that + * the resource is too and that the upper 32-bits match. + */ + if (((ap->phys_hi >> 24) & 3) == 3) { + if (((res->flags & IORESOURCE_MEM) == 0) || + ((res->flags & PCI_BASE_ADDRESS_MEM_TYPE_MASK) + != PCI_BASE_ADDRESS_MEM_TYPE_64)) + bad_assignment(ap, res, 1); + if ((res->start >> 32) != ap->phys_mid) + bad_assignment(ap, res, 1); + + /* PBM cannot generate cpu initiated PIOs + * to the full 64-bit space. Therefore the + * upper 32-bits better be zero. If it is + * not, just skip it and we will assign it + * properly ourselves. + */ + if ((res->start >> 32) != 0UL) { + printk(KERN_ERR "PCI: OBP assigns out of range MEM address " + "%016lx for region %ld on device %s\n", + res->start, (res - &pdev->resource[0]), pdev->name); + continue; + } + } + /* Adjust the resource into the physical address space * of this PBM. */ @@ -425,13 +484,21 @@ static int __init pci_intmap_match(struct pci_dev *pdev, unsigned int *interrupt return 0; /* If we are underneath a PCI bridge, use PROM register - * property of parent bridge. + * property of the parent bridge which is closest to + * the PBM. */ if (pdev->bus->number != pbm->pci_first_busno) { struct pcidev_cookie *bus_pcp; + struct pci_dev *pwalk; int offset; - bus_pcp = pdev->bus->self->sysdata; + pwalk = pdev->bus->self; + while (pwalk->bus && + pwalk->bus->number != pbm->pci_first_busno) + pwalk = pwalk->bus->self; + + bus_pcp = pwalk->bus->self->sysdata; + pregs = bus_pcp->prom_regs; offset = prom_getint(bus_pcp->prom_node, "fcode-rom-offset"); diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c index a45fe4740..8d7db0c9b 100644 --- a/arch/sparc64/kernel/pci_psycho.c +++ b/arch/sparc64/kernel/pci_psycho.c @@ -1,4 +1,4 @@ -/* $Id: pci_psycho.c,v 1.15 2000/03/25 05:18:11 davem Exp $ +/* $Id: pci_psycho.c,v 1.16 2000/04/15 10:06:16 davem Exp $ * pci_psycho.c: PSYCHO/U2P specific PCI controller support. * * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@caipfs.rutgers.edu) @@ -1074,22 +1074,34 @@ static void __init psycho_base_address_update(struct pci_dev *pdev, int resource { struct pcidev_cookie *pcp = pdev->sysdata; struct pci_pbm_info *pbm = pcp->pbm; - struct resource *res = &pdev->resource[resource]; - struct resource *root; + struct resource *res, *root; u32 reg; - int where, size; + int where, size, is_64bit; + res = &pdev->resource[resource]; + where = PCI_BASE_ADDRESS_0 + (resource * 4); + + is_64bit = 0; if (res->flags & IORESOURCE_IO) root = &pbm->io_space; - else + else { root = &pbm->mem_space; + if ((res->flags & PCI_BASE_ADDRESS_MEM_TYPE_MASK) + == PCI_BASE_ADDRESS_MEM_TYPE_64) + is_64bit = 1; + } - where = PCI_BASE_ADDRESS_0 + (resource * 4); size = res->end - res->start; pci_read_config_dword(pdev, where, ®); reg = ((reg & size) | (((u32)(res->start - root->start)) & ~size)); pci_write_config_dword(pdev, where, reg); + + /* This knows that the upper 32-bits of the address + * must be zero. Our PCI common layer enforces this. + */ + if (is_64bit) + pci_write_config_dword(pdev, where + 4, 0); } /* We have to do the config space accesses by hand, thus... */ diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c index a55772179..99f7ba8ad 100644 --- a/arch/sparc64/kernel/pci_sabre.c +++ b/arch/sparc64/kernel/pci_sabre.c @@ -1,4 +1,4 @@ -/* $Id: pci_sabre.c,v 1.16 2000/03/25 05:18:12 davem Exp $ +/* $Id: pci_sabre.c,v 1.19 2000/04/15 13:07:51 davem Exp $ * pci_sabre.c: Sabre specific PCI controller support. * * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@caipfs.rutgers.edu) @@ -1012,22 +1012,35 @@ static void __init sabre_base_address_update(struct pci_dev *pdev, int resource) struct pcidev_cookie *pcp = pdev->sysdata; struct pci_pbm_info *pbm = pcp->pbm; struct pci_controller_info *p = pbm->parent; - struct resource *res = &pdev->resource[resource]; + struct resource *res; unsigned long base; u32 reg; - int where, size; + int where, size, is_64bit; + res = &pdev->resource[resource]; + where = PCI_BASE_ADDRESS_0 + (resource * 4); + + is_64bit = 0; if (res->flags & IORESOURCE_IO) base = p->controller_regs + SABRE_IOSPACE; - else + else { base = p->controller_regs + SABRE_MEMSPACE; + if ((res->flags & PCI_BASE_ADDRESS_MEM_TYPE_MASK) + == PCI_BASE_ADDRESS_MEM_TYPE_64) + is_64bit = 1; + } - where = PCI_BASE_ADDRESS_0 + (resource * 4); size = res->end - res->start; pci_read_config_dword(pdev, where, ®); reg = ((reg & size) | (((u32)(res->start - base)) & ~size)); pci_write_config_dword(pdev, where, reg); + + /* This knows that the upper 32-bits of the address + * must be zero. Our PCI common layer enforces this. + */ + if (is_64bit) + pci_write_config_dword(pdev, where + 4, 0); } static void __init apb_init(struct pci_controller_info *p, struct pci_bus *sabre_bus) @@ -1050,6 +1063,20 @@ static void __init apb_init(struct pci_controller_info *p, struct pci_bus *sabre /* Status register bits are "write 1 to clear". */ sabre_write_word(pdev, PCI_STATUS, 0xffff); sabre_write_word(pdev, PCI_SEC_STATUS, 0xffff); + + /* Use a primary/seconday latency timer value + * of 64. + */ + sabre_write_byte(pdev, PCI_LATENCY_TIMER, 64); + sabre_write_byte(pdev, PCI_SEC_LATENCY_TIMER, 64); + + /* Enable reporting/forwarding of master aborts, + * parity, and SERR. + */ + sabre_write_byte(pdev, PCI_BRIDGE_CONTROL, + (PCI_BRIDGE_CTL_PARITY | + PCI_BRIDGE_CTL_SERR | + PCI_BRIDGE_CTL_MASTER_ABORT)); } } } @@ -1086,17 +1113,6 @@ static void __init sabre_scan_bus(struct pci_controller_info *p) sabre_bus = pci_scan_bus(p->pci_first_busno, p->pci_ops, &p->pbm_A); - - { - unsigned int devfn; - u8 *addr; - - devfn = PCI_DEVFN(0, 0); - addr = sabre_pci_config_mkaddr(&p->pbm_A, 0, - devfn, PCI_LATENCY_TIMER); - pci_config_write8(addr, 32); - } - apb_init(p, sabre_bus); walk = &sabre_bus->children; diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c index e612d0200..ccf0c03bf 100644 --- a/arch/sparc64/kernel/power.c +++ b/arch/sparc64/kernel/power.c @@ -1,4 +1,4 @@ -/* $Id: power.c,v 1.5 1999/12/19 23:28:00 davem Exp $ +/* $Id: power.c,v 1.6 2000/04/13 00:59:59 davem Exp $ * power.c: Power management driver. * * Copyright (C) 1999 David S. Miller (davem@redhat.com) @@ -55,8 +55,7 @@ static int powerd(void *__unused) static char *envp[] = { "HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL }; char *argv[] = { "/usr/bin/shutdown", "-h", "now", NULL }; - current->session = 1; - current->pgrp = 1; + daemonize(); sprintf(current->comm, "powerd"); again: diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c index 8ac030324..fb0e8f411 100644 --- a/arch/sparc64/kernel/process.c +++ b/arch/sparc64/kernel/process.c @@ -1,4 +1,4 @@ -/* $Id: process.c,v 1.105 2000/03/26 09:13:48 davem Exp $ +/* $Id: process.c,v 1.106 2000/04/15 06:02:50 davem Exp $ * arch/sparc64/kernel/process.c * * Copyright (C) 1995, 1996 David S. Miller (davem@caip.rutgers.edu) @@ -269,9 +269,8 @@ void __show_regs(struct pt_regs * regs) unsigned long flags; spin_lock_irqsave(®dump_lock, flags); - printk("CPU[%d]: local_irq_count[%u] global_irq_count[%d]\n", - smp_processor_id(), local_irq_count, - atomic_read(&global_irq_count)); + printk("CPU[%d]: local_irq_count[%u] irqs_running[%d]\n", + smp_processor_id(), local_irq_count, irqs_running()); #endif printk("TSTATE: %016lx TPC: %016lx TNPC: %016lx Y: %08x\n", regs->tstate, regs->tpc, regs->tnpc, regs->y); diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c index c582be060..f061c417f 100644 --- a/arch/sparc64/kernel/ptrace.c +++ b/arch/sparc64/kernel/ptrace.c @@ -68,7 +68,7 @@ pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr) static void pt_os_succ_return (struct pt_regs *regs, unsigned long val, long *addr) { - if (current->personality & PER_BSD) + if (current->personality == PER_SUNOS) pt_succ_return (regs, val); else pt_succ_return_linux (regs, val, addr); @@ -164,8 +164,8 @@ asmlinkage void do_ptrace(struct pt_regs *regs) goto out; } - if (((current->personality & PER_BSD) && (request == PTRACE_SUNATTACH)) - || (!(current->personality & PER_BSD) && (request == PTRACE_ATTACH))) { + if ((current->personality == PER_SUNOS && request == PTRACE_SUNATTACH) + || (current->personality != PER_SUNOS && request == PTRACE_ATTACH)) { unsigned long flags; if(child == current) { @@ -203,9 +203,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs) pt_succ_return(regs, 0); goto out; } - if (!(child->flags & PF_PTRACED) - && ((current->personality & PER_BSD) && (request != PTRACE_SUNATTACH)) - && (!(current->personality & PER_BSD) && (request != PTRACE_ATTACH))) { + if (!(child->flags & PF_PTRACED)) { pt_error_return(regs, ESRCH); goto out; } diff --git a/arch/sparc64/kernel/sbus.c b/arch/sparc64/kernel/sbus.c index c9a0d4a59..602ee9ca2 100644 --- a/arch/sparc64/kernel/sbus.c +++ b/arch/sparc64/kernel/sbus.c @@ -1,4 +1,4 @@ -/* $Id: sbus.c,v 1.10 2000/03/10 07:52:08 davem Exp $ +/* $Id: sbus.c,v 1.11 2000/04/14 09:13:04 davem Exp $ * sbus.c: UltraSparc SBUS controller support. * * Copyright (C) 1999 David S. Miller (davem@redhat.com) @@ -315,7 +315,7 @@ void sbus_free_consistent(struct sbus_dev *sdev, size_t size, void *cpu, dma_add dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *ptr, size_t size, int dir) { struct sbus_iommu *iommu = sdev->bus->iommu; - unsigned long npages, phys_base, flags; + unsigned long npages, pbase, flags; iopte_t *iopte; u32 dma_base, offset; unsigned long iopte_bits; @@ -323,10 +323,10 @@ dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *ptr, size_t size, int di if (dir == SBUS_DMA_NONE) BUG(); - phys_base = (unsigned long) ptr; - offset = (u32) (phys_base & ~PAGE_MASK); - size = (PAGE_ALIGN(phys_base + size) - (phys_base & PAGE_MASK)); - phys_base = (unsigned long) __pa(phys_base & PAGE_MASK); + pbase = (unsigned long) ptr; + offset = (u32) (pbase & ~PAGE_MASK); + size = (PAGE_ALIGN(pbase + size) - (pbase & PAGE_MASK)); + pbase = (unsigned long) __pa(pbase & PAGE_MASK); spin_lock_irqsave(&iommu->lock, flags); npages = size >> PAGE_SHIFT; @@ -337,8 +337,8 @@ dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *ptr, size_t size, int di if (dir != SBUS_DMA_TODEVICE) iopte_bits |= IOPTE_WRITE; while (npages--) { - *iopte++ = __iopte(iopte_bits | (phys_base & IOPTE_PAGE)); - phys_base += PAGE_SIZE; + *iopte++ = __iopte(iopte_bits | (pbase & IOPTE_PAGE)); + pbase += PAGE_SIZE; } npages = size >> PAGE_SHIFT; spin_unlock_irqrestore(&iommu->lock, flags); diff --git a/arch/sparc64/kernel/signal.c b/arch/sparc64/kernel/signal.c index e7a50c150..efd6a64d1 100644 --- a/arch/sparc64/kernel/signal.c +++ b/arch/sparc64/kernel/signal.c @@ -1,4 +1,4 @@ -/* $Id: signal.c,v 1.48 1999/12/15 22:24:52 davem Exp $ +/* $Id: signal.c,v 1.49 2000/04/08 02:11:46 davem Exp $ * arch/sparc64/kernel/signal.c * * Copyright (C) 1991, 1992 Linus Torvalds diff --git a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c index 423c5f648..1f5c03716 100644 --- a/arch/sparc64/kernel/signal32.c +++ b/arch/sparc64/kernel/signal32.c @@ -1,4 +1,4 @@ -/* $Id: signal32.c,v 1.60 2000/02/25 06:02:37 jj Exp $ +/* $Id: signal32.c,v 1.62 2000/04/12 08:10:19 davem Exp $ * arch/sparc64/kernel/signal32.c * * Copyright (C) 1991, 1992 Linus Torvalds @@ -750,8 +750,7 @@ static inline void new_setup_frame32(struct k_sigaction *ka, struct pt_regs *reg goto sigsegv; if(pte_present(*ptep)) { - unsigned long page = (unsigned long) - __va(pte_pagenr(*ptep) << PAGE_SHIFT); + unsigned long page = page_address(pte_page(*ptep)); __asm__ __volatile__(" membar #StoreStore @@ -1176,8 +1175,7 @@ static inline void setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs goto sigsegv; if(pte_present(*ptep)) { - unsigned long page = (unsigned long) - __va(pte_pagenr(*ptep) << PAGE_SHIFT); + unsigned long page = page_address(pte_page(*ptep)); __asm__ __volatile__(" membar #StoreStore diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index e9a180d2a..2ef0d1004 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c @@ -87,7 +87,6 @@ void __init smp_store_cpu_info(int id) { int i; - cpu_data[id].irq_count = 0; cpu_data[id].bh_count = 0; /* multiplier and counter set by smp_setup_percpu_timer() */ @@ -627,33 +626,7 @@ void smp_promstop_others(void) smp_cross_call(&xcall_promstop, 0, 0, 0); } -static inline void sparc64_do_profile(unsigned long pc, unsigned long o7) -{ - if (prof_buffer && current->pid) { - extern int _stext; - extern int rwlock_impl_begin, rwlock_impl_end; - extern int atomic_impl_begin, atomic_impl_end; - extern int __memcpy_begin, __memcpy_end; - extern int __bitops_begin, __bitops_end; - - if ((pc >= (unsigned long) &atomic_impl_begin && - pc < (unsigned long) &atomic_impl_end) || - (pc >= (unsigned long) &rwlock_impl_begin && - pc < (unsigned long) &rwlock_impl_end) || - (pc >= (unsigned long) &__memcpy_begin && - pc < (unsigned long) &__memcpy_end) || - (pc >= (unsigned long) &__bitops_begin && - pc < (unsigned long) &__bitops_end)) - pc = o7; - - pc -= (unsigned long) &_stext; - pc >>= prof_shift; - - if(pc >= prof_len) - pc = prof_len - 1; - atomic_inc((atomic_t *)&prof_buffer[pc]); - } -} +extern void sparc64_do_profile(unsigned long pc, unsigned long o7); static unsigned long current_tick_offset; @@ -682,40 +655,29 @@ void smp_percpu_timer_interrupt(struct pt_regs *regs) clear_softint((1UL << 0)); do { - if(!user) + if (!user) sparc64_do_profile(regs->tpc, regs->u_regs[UREG_RETPC]); - if(!--prof_counter(cpu)) - { + if (!--prof_counter(cpu)) { if (cpu == boot_cpu_id) { -/* XXX Keep this in sync with irq.c --DaveM */ -#define irq_enter(cpu, irq) \ -do { hardirq_enter(cpu); \ - spin_unlock_wait(&global_irq_lock); \ -} while(0) -#define irq_exit(cpu, irq) hardirq_exit(cpu) - irq_enter(cpu, 0); - kstat.irqs[cpu][0]++; + kstat.irqs[cpu][0]++; timer_tick_interrupt(regs); irq_exit(cpu, 0); - -#undef irq_enter -#undef irq_exit } - if(current->pid) { + if (current->pid) { unsigned int *inc, *inc2; update_one_process(current, 1, user, !user, cpu); - if(--current->counter <= 0) { + if (--current->counter <= 0) { current->counter = 0; current->need_resched = 1; } - if(user) { - if(current->priority < DEF_PRIORITY) { + if (user) { + if (current->priority < DEF_PRIORITY) { inc = &kstat.cpu_nice; inc2 = &kstat.per_cpu_nice[cpu]; } else { @@ -862,7 +824,7 @@ cycles_t cacheflush_time; static void __init smp_tune_scheduling (void) { - unsigned long flush_base, flags, *p; + unsigned long orig_flush_base, flush_base, flags, *p; unsigned int ecache_size, order; cycles_t tick1, tick2, raw; @@ -881,7 +843,8 @@ static void __init smp_tune_scheduling (void) "ecache-size", (512 * 1024)); if (ecache_size > (4 * 1024 * 1024)) ecache_size = (4 * 1024 * 1024); - flush_base = __get_free_pages(GFP_KERNEL, order = get_order(ecache_size)); + orig_flush_base = flush_base = + __get_free_pages(GFP_KERNEL, order = get_order(ecache_size)); if (flush_base != 0UL) { __save_and_cli(flags); @@ -923,7 +886,7 @@ static void __init smp_tune_scheduling (void) */ cacheflush_time = (raw - (raw >> 2)); - free_pages(flush_base, order); + free_pages(orig_flush_base, order); } else { cacheflush_time = ((ecache_size << 2) + (ecache_size << 1)); diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c index fc7a8cfe5..f68d6ee9e 100644 --- a/arch/sparc64/kernel/sparc64_ksyms.c +++ b/arch/sparc64/kernel/sparc64_ksyms.c @@ -1,4 +1,4 @@ -/* $Id: sparc64_ksyms.c,v 1.80 2000/03/27 10:38:47 davem Exp $ +/* $Id: sparc64_ksyms.c,v 1.83 2000/04/19 08:38:25 davem Exp $ * arch/sparc64/kernel/sparc64_ksyms.c: Sparc64 specific ksyms support. * * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu) @@ -81,6 +81,8 @@ extern int sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg); extern int sys32_ioctl(unsigned int fd, unsigned int cmd, u32 arg); extern int (*handle_mathemu)(struct pt_regs *, struct fpustate *); extern long sparc32_open(const char * filename, int flags, int mode); +extern int register_ioctl32_conversion(unsigned int cmd, int (*handler)(unsigned int, unsigned int, unsigned long, struct file *)); +extern int unregister_ioctl32_conversion(unsigned int cmd); extern void bcopy (const char *, char *, int); extern int __ashrdi3(int, int); @@ -129,8 +131,6 @@ EXPORT_SYMBOL(kernel_flag); /* Hard IRQ locking */ EXPORT_SYMBOL(global_irq_holder); -EXPORT_SYMBOL(global_irq_lock); -EXPORT_SYMBOL(global_irq_count); EXPORT_SYMBOL(synchronize_irq); EXPORT_SYMBOL_PRIVATE(global_cli); EXPORT_SYMBOL_PRIVATE(global_sti); @@ -219,6 +219,10 @@ EXPORT_SYMBOL(pci_dma_sync_sg); EXPORT_SYMBOL(pci_dma_supported); #endif +/* IOCTL32 emulation hooks. */ +EXPORT_SYMBOL(register_ioctl32_conversion); +EXPORT_SYMBOL(unregister_ioctl32_conversion); + /* Solaris/SunOS binary compatibility */ EXPORT_SYMBOL(_sigpause_common); @@ -297,8 +301,8 @@ EXPORT_SYMBOL(move_addr_to_user); /* Special internal versions of library functions. */ EXPORT_SYMBOL(__memcpy); EXPORT_SYMBOL(__memset); -EXPORT_SYMBOL(clear_page); -EXPORT_SYMBOL(copy_page); +EXPORT_SYMBOL(_clear_page); +EXPORT_SYMBOL(_copy_page); EXPORT_SYMBOL(clear_user_page); EXPORT_SYMBOL(copy_user_page); EXPORT_SYMBOL(__bzero); diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c index 82aedbb08..16edc28f6 100644 --- a/arch/sparc64/kernel/sys_sparc.c +++ b/arch/sparc64/kernel/sys_sparc.c @@ -1,4 +1,4 @@ -/* $Id: sys_sparc.c,v 1.37 2000/03/17 05:48:46 anton Exp $ +/* $Id: sys_sparc.c,v 1.38 2000/04/13 07:30:34 jj Exp $ * linux/arch/sparc64/kernel/sys_sparc.c * * This file contains various random system calls that @@ -23,6 +23,7 @@ #include <linux/smp_lock.h> #include <linux/malloc.h> #include <linux/ipc.h> +#include <linux/personality.h> #include <asm/uaccess.h> #include <asm/ipc.h> @@ -182,6 +183,33 @@ out: return err; } +extern asmlinkage int sys_newuname(struct new_utsname * name); + +asmlinkage int sparc64_newuname(struct new_utsname * name) +{ + int ret = sys_newuname(name); + + if (current->personality == PER_LINUX32 && !ret) { + ret = copy_to_user(name->machine, "sparc\0\0", 8); + } + return ret; +} + +extern asmlinkage long sys_personality(unsigned long); + +asmlinkage int sparc64_personality(unsigned long personality) +{ + int ret; + lock_kernel(); + if (current->personality == PER_LINUX32 && personality == PER_LINUX) + personality = PER_LINUX32; + ret = sys_personality(personality); + unlock_kernel(); + if (ret == PER_LINUX32) + ret = PER_LINUX; + return ret; +} + /* Linux version of mmap */ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, @@ -232,7 +260,7 @@ asmlinkage long sys64_munmap(unsigned long addr, size_t len) (addr < PAGE_OFFSET && addr + len > -PAGE_OFFSET)) return -EINVAL; down(¤t->mm->mmap_sem); - ret = do_munmap(addr, len); + ret = do_munmap(current->mm, addr, len); up(¤t->mm->mmap_sem); return ret; } diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c index b1eb160ad..7bb75f4ae 100644 --- a/arch/sparc64/kernel/sys_sparc32.c +++ b/arch/sparc64/kernel/sys_sparc32.c @@ -1,4 +1,4 @@ -/* $Id: sys_sparc32.c,v 1.142 2000/03/24 04:17:38 davem Exp $ +/* $Id: sys_sparc32.c,v 1.145 2000/04/13 07:30:34 jj Exp $ * sys_sparc32.c: Conversion between 32bit and 64bit native syscalls. * * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) @@ -3542,6 +3542,18 @@ struct nfsctl_fhparm32 { s32 gf32_version; }; +struct nfsctl_fdparm32 { + struct sockaddr gd32_addr; + s8 gd32_path[NFS_MAXPATHLEN+1]; + s32 gd32_version; +}; + +struct nfsctl_fsparm32 { + struct sockaddr gd32_addr; + s8 gd32_path[NFS_MAXPATHLEN+1]; + s32 gd32_maxlen; +}; + struct nfsctl_arg32 { s32 ca32_version; /* safeguard */ union { @@ -3550,15 +3562,17 @@ struct nfsctl_arg32 { struct nfsctl_export32 u32_export; struct nfsctl_uidmap32 u32_umap; struct nfsctl_fhparm32 u32_getfh; - u32 u32_debug; + struct nfsctl_fdparm32 u32_getfd; + struct nfsctl_fsparm32 u32_getfs; } u; #define ca32_svc u.u32_svc #define ca32_client u.u32_client #define ca32_export u.u32_export #define ca32_umap u.u32_umap #define ca32_getfh u.u32_getfh +#define ca32_getfd u.u32_getfd +#define ca32_getfs u.u32_getfs #define ca32_authd u.u32_authd -#define ca32_debug u.u32_debug }; union nfsctl_res32 { @@ -3689,6 +3703,38 @@ static int nfs_getfh32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32 return err; } +static int nfs_getfd32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32) +{ + int err; + + err = __get_user(karg->ca_version, &arg32->ca32_version); + err |= copy_from_user(&karg->ca_getfd.gd_addr, + &arg32->ca32_getfd.gd32_addr, + (sizeof(struct sockaddr))); + err |= copy_from_user(&karg->ca_getfd.gd_path, + &arg32->ca32_getfd.gd32_path, + (NFS_MAXPATHLEN+1)); + err |= __get_user(karg->ca_getfd.gd_version, + &arg32->ca32_getfd.gd32_version); + return err; +} + +static int nfs_getfs32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32) +{ + int err; + + err = __get_user(karg->ca_version, &arg32->ca32_version); + err |= copy_from_user(&karg->ca_getfs.gd_addr, + &arg32->ca32_getfs.gd32_addr, + (sizeof(struct sockaddr))); + err |= copy_from_user(&karg->ca_getfs.gd_path, + &arg32->ca32_getfs.gd32_path, + (NFS_MAXPATHLEN+1)); + err |= __get_user(karg->ca_getfs.gd_maxlen, + &arg32->ca32_getfs.gd32_maxlen); + return err; +} + /* This really doesn't need translations, we are only passing * back a union which contains opaque nfs file handle data. */ @@ -3727,6 +3773,7 @@ int asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsct err = nfs_clnt32_trans(karg, arg32); break; case NFSCTL_EXPORT: + case NFSCTL_UNEXPORT: err = nfs_exp32_trans(karg, arg32); break; /* This one is unimplemented, be we're ready for it. */ @@ -3736,6 +3783,12 @@ int asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsct case NFSCTL_GETFH: err = nfs_getfh32_trans(karg, arg32); break; + case NFSCTL_GETFD: + err = nfs_getfd32_trans(karg, arg32); + break; + case NFSCTL_GETFS: + err = nfs_getfs32_trans(karg, arg32); + break; default: err = -EINVAL; break; @@ -3747,7 +3800,12 @@ int asmlinkage sys32_nfsservctl(int cmd, struct nfsctl_arg32 *arg32, union nfsct err = sys_nfsservctl(cmd, karg, kres); set_fs(oldfs); - if(!err && cmd == NFSCTL_GETFH) + if (err) + goto done; + + if((cmd == NFSCTL_GETFH) || + (cmd == NFSCTL_GETFD) || + (cmd == NFSCTL_GETFS)) err = nfs_getfh32_res_trans(kres, res32); done: @@ -3922,18 +3980,6 @@ asmlinkage int sys32_prctl(int option, u32 arg2, u32 arg3, u32 arg4, u32 arg5) } -extern asmlinkage int sys_newuname(struct new_utsname * name); - -asmlinkage int sys32_newuname(struct new_utsname * name) -{ - int ret = sys_newuname(name); - - if (current->personality == PER_LINUX32 && !ret) { - ret = copy_to_user(name->machine, "sparc\0\0", 8); - } - return ret; -} - extern asmlinkage ssize_t sys_pread(unsigned int fd, char * buf, size_t count, loff_t pos); @@ -3955,21 +4001,6 @@ asmlinkage ssize_t32 sys32_pwrite(unsigned int fd, char *ubuf, } -extern asmlinkage long sys_personality(unsigned long); - -asmlinkage int sys32_personality(unsigned long personality) -{ - int ret; - lock_kernel(); - if (current->personality == PER_LINUX32 && personality == PER_LINUX) - personality = PER_LINUX32; - ret = sys_personality(personality); - unlock_kernel(); - if (ret == PER_LINUX32) - ret = PER_LINUX; - return ret; -} - extern asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t count); asmlinkage int sys32_sendfile(int out_fd, int in_fd, __kernel_off_t32 *offset, s32 count) diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c index 291b174ac..1370d0231 100644 --- a/arch/sparc64/kernel/sys_sunos32.c +++ b/arch/sparc64/kernel/sys_sunos32.c @@ -1,4 +1,4 @@ -/* $Id: sys_sunos32.c,v 1.43 2000/03/26 11:28:53 davem Exp $ +/* $Id: sys_sunos32.c,v 1.45 2000/04/13 00:55:49 davem Exp $ * sys_sunos32.c: SunOS binary compatability layer on sparc64. * * Copyright (C) 1995, 1996, 1997 David S. Miller (davem@caip.rutgers.edu) @@ -45,6 +45,7 @@ #include <linux/socket.h> #include <linux/in.h> #include <linux/nfs.h> +#include <linux/nfs2.h> #include <linux/nfs_mount.h> /* for sunos_select */ @@ -69,7 +70,6 @@ asmlinkage u32 sunos_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u32 of down(¤t->mm->mmap_sem); lock_kernel(); - current->personality |= PER_BSD; if(flags & MAP_NORESERVE) { static int cnt; if (cnt++ < 10) @@ -141,7 +141,7 @@ asmlinkage int sunos_brk(u32 baddr) /* Always allow shrinking brk. */ if (brk <= current->mm->brk) { current->mm->brk = brk; - do_munmap(newbrk, oldbrk-newbrk); + do_munmap(current->mm, newbrk, oldbrk-newbrk); goto out; } /* Check against rlimit and stack.. */ @@ -549,7 +549,6 @@ asmlinkage int sunos_select(int width, u32 inp, u32 outp, u32 exp, u32 tvp_x) /* SunOS binaries expect that select won't change the tvp contents */ lock_kernel(); - current->personality |= STICKY_TIMEOUTS; ret = sys32_select (width, inp, outp, exp, tvp_x); if (ret == -EINTR && tvp_x) { struct timeval32 *tvp = (struct timeval32 *)A(tvp_x); @@ -685,7 +684,7 @@ static int sunos_nfs_mount(char *dir_name, int linux_flags, void *data) * address to create a socket and bind it to a reserved * port on this system */ - if (copy_from_user(&sunos_mount, data, sizeof(sunos_mount)) + if (copy_from_user(&sunos_mount, data, sizeof(sunos_mount))) return -EFAULT; server_fd = sys_socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP); @@ -776,14 +775,14 @@ sunos_mount(char *type, char *dir, int flags, void *data) dev_fname = getname(data); } else if(strcmp(type_page, "nfs") == 0) { ret = sunos_nfs_mount (dir_page, flags, data); - goto out2 + goto out2; } else if(strcmp(type_page, "ufs") == 0) { printk("Warning: UFS filesystem mounts unsupported.\n"); ret = -ENODEV; - goto out2 + goto out2; } else if(strcmp(type_page, "proc")) { ret = -ENODEV; - goto out2 + goto out2; } ret = PTR_ERR(dev_fname); if (IS_ERR(dev_fname)) @@ -1214,7 +1213,6 @@ asmlinkage int sunos_open(u32 fname, int flags, int mode) { const char *filename = (const char *)(long)fname; - current->personality |= PER_BSD; return sparc32_open(filename, flags, mode); } @@ -1350,8 +1348,6 @@ asmlinkage int sunos_sigaction (int sig, u32 act, u32 oact) struct k_sigaction new_ka, old_ka; int ret; - current->personality |= PER_BSD; - if (act) { old_sigset_t32 mask; diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S index d86649bf7..eb02486f5 100644 --- a/arch/sparc64/kernel/systbls.S +++ b/arch/sparc64/kernel/systbls.S @@ -1,4 +1,4 @@ -/* $Id: systbls.S,v 1.71 2000/03/15 02:43:36 davem Exp $ +/* $Id: systbls.S,v 1.72 2000/04/13 07:30:34 jj Exp $ * systbls.S: System call entry point tables for OS compatibility. * The native Linux system call table lives here also. * @@ -56,8 +56,8 @@ sys_call_table32: /*170*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys32_getdents .word sys_setsid, sys_fchdir, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall /*180*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys32_sigpending, sys32_query_module - .word sys_setpgid, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys32_newuname -/*190*/ .word sys32_init_module, sys32_personality, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall + .word sys_setpgid, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sparc64_newuname +/*190*/ .word sys32_init_module, sparc64_personality, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall .word sys_nis_syscall, sys_nis_syscall, sys_getppid, sys32_sigaction, sys_sgetmask /*200*/ .word sys_ssetmask, sys_sigsuspend, sys32_newlstat, sys_uselib, old32_readdir .word sys_nis_syscall, sys32_socketcall, sys_syslog, sys_nis_syscall, sys_nis_syscall @@ -115,8 +115,8 @@ sys_call_table: /*170*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_getdents .word sys_setsid, sys_fchdir, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall /*180*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_query_module - .word sys_setpgid, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_newuname -/*190*/ .word sys_init_module, sys_personality, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall + .word sys_setpgid, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sparc64_newuname +/*190*/ .word sys_init_module, sparc64_personality, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall .word sys_nis_syscall, sys_nis_syscall, sys_getppid, sys_nis_syscall, sys_sgetmask /*200*/ .word sys_ssetmask, sys_nis_syscall, sys_newlstat, sys_uselib, sys_nis_syscall .word sys_nis_syscall, sys_socketcall, sys_syslog, sys_nis_syscall, sys_nis_syscall diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c index e599b48cb..a955e75df 100644 --- a/arch/sparc64/kernel/time.c +++ b/arch/sparc64/kernel/time.c @@ -1,4 +1,4 @@ -/* $Id: time.c,v 1.24 2000/03/02 02:00:25 davem Exp $ +/* $Id: time.c,v 1.25 2000/04/13 05:29:44 davem Exp $ * time.c: UltraSparc timer and TOD clock support. * * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) @@ -67,6 +67,34 @@ static __inline__ void timer_check_rtc(void) } } +void sparc64_do_profile(unsigned long pc, unsigned long o7) +{ + if (prof_buffer && current->pid) { + extern int _stext; + extern int rwlock_impl_begin, rwlock_impl_end; + extern int atomic_impl_begin, atomic_impl_end; + extern int __memcpy_begin, __memcpy_end; + extern int __bitops_begin, __bitops_end; + + if ((pc >= (unsigned long) &atomic_impl_begin && + pc < (unsigned long) &atomic_impl_end) || + (pc >= (unsigned long) &rwlock_impl_begin && + pc < (unsigned long) &rwlock_impl_end) || + (pc >= (unsigned long) &__memcpy_begin && + pc < (unsigned long) &__memcpy_end) || + (pc >= (unsigned long) &__bitops_begin && + pc < (unsigned long) &__bitops_end)) + pc = o7; + + pc -= (unsigned long) &_stext; + pc >>= prof_shift; + + if(pc >= prof_len) + pc = prof_len - 1; + atomic_inc((atomic_t *)&prof_buffer[pc]); + } +} + static void timer_interrupt(int irq, void *dev_id, struct pt_regs * regs) { unsigned long ticks, pstate; @@ -74,6 +102,10 @@ static void timer_interrupt(int irq, void *dev_id, struct pt_regs * regs) write_lock(&xtime_lock); do { +#ifndef __SMP__ + if ((regs->tstate & TSTATE_PRIV) != 0) + sparc64_do_profile(regs->tpc, regs->u_regs[UREG_RETPC]); +#endif do_timer(regs); /* Guarentee that the following sequences execute |