Commit 5733013c authored by Linus Torvalds's avatar Linus Torvalds

Import 2.4.0-test4pre3

parent 4a5b5d80
......@@ -255,7 +255,7 @@ static unsigned int load_irix_interp(struct elfhdr * interp_elf_ex,
/* First of all, some simple consistency checks */
if ((interp_elf_ex->e_type != ET_EXEC &&
interp_elf_ex->e_type != ET_DYN) ||
!elf_check_arch(interp_elf_ex->e_machine) ||
!irix_elf_check_arch(interp_elf_ex) ||
!interpreter->f_op->mmap) {
printk("IRIX interp has bad e_type %d\n", interp_elf_ex->e_type);
return 0xffffffff;
......@@ -395,7 +395,7 @@ static int verify_binary(struct elfhdr *ehp, struct linux_binprm *bprm)
/* First of all, some simple consistency checks */
if((ehp->e_type != ET_EXEC && ehp->e_type != ET_DYN) ||
!elf_check_arch(ehp->e_machine) || !bprm->file->f_op->mmap) {
!irix_elf_check_arch(ehp) || !bprm->file->f_op->mmap) {
return -ENOEXEC;
}
......@@ -810,7 +810,7 @@ static int load_irix_library(struct file *file)
/* First of all, some simple consistency checks. */
if(elf_ex.e_type != ET_EXEC || elf_ex.e_phnum > 2 ||
!elf_check_arch(elf_ex.e_machine) || !file->f_op->mmap)
!irix_elf_check_arch(&elf_ex) || !file->f_op->mmap)
return -ENOEXEC;
/* Now read in all of the header information. */
......
/* $Id: pcic.c,v 1.15 2000/06/20 01:10:00 anton Exp $
/* $Id: pcic.c,v 1.16 2000/07/11 01:38:57 davem Exp $
* pcic.c: Sparc/PCI controller support
*
* Copyright (C) 1998 V. Roganov and G. Raiko
......@@ -808,7 +808,7 @@ static __inline__ unsigned long do_gettimeoffset(void)
return offset + count;
}
extern volatile unsigned long lost_ticks;
extern volatile unsigned long wall_jiffies;
static void pci_do_gettimeofday(struct timeval *tv)
{
......@@ -819,10 +819,11 @@ static void pci_do_gettimeofday(struct timeval *tv)
tv->tv_usec += do_gettimeoffset();
/*
* xtime is atomically updated in timer_bh. lost_ticks is
* nonzero if the timer bottom half hasnt executed yet.
* xtime is atomically updated in timer_bh. The difference
* between jiffies and wall_jiffies is nonzero if the timer
* bottom half hasnt executed yet.
*/
if (lost_ticks)
if ((jiffies - wall_jiffies) != 0)
tv->tv_usec += USECS_PER_JIFFY;
restore_flags(flags);
......
/* $Id: process.c,v 1.148 2000/07/10 23:22:32 anton Exp $
/* $Id: process.c,v 1.150 2000/07/11 18:49:22 anton Exp $
* linux/arch/sparc/kernel/process.c
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
......@@ -126,9 +126,10 @@ int cpu_idle(void)
extern char reboot_command [];
extern int serial_console;
#ifdef CONFIG_SUN_CONSOLE
extern void (*prom_palette)(int);
extern int serial_console;
#endif
void machine_halt(void)
......@@ -169,7 +170,7 @@ void machine_restart(char * cmd)
void machine_power_off(void)
{
#ifdef CONFIG_SUN_AUXIO
if (auxio_power_register)
if (auxio_power_register && !serial_console)
*auxio_power_register |= AUXIO_POWER_OFF;
#endif
machine_halt();
......
/* $Id: entry.S,v 1.116 2000/06/19 06:24:37 davem Exp $
/* $Id: entry.S,v 1.117 2000/07/11 02:21:12 davem Exp $
* arch/sparc64/kernel/entry.S: Sparc64 trap low-level entry points.
*
* Copyright (C) 1995,1997 David S. Miller (davem@caip.rutgers.edu)
......@@ -1094,3 +1094,58 @@ __flushw_user:
restore %g0, %g0, %g0
2: retl
nop
/* This need not obtain the xtime_lock as it is coded in
* an implicitly SMP safe way already.
*/
.align 64
.globl do_gettimeofday
do_gettimeofday: /* %o0 = timevalp */
/* Load doubles must be used on xtime so that what we get
* is guarenteed to be atomic, this is why we can run this
* with interrupts on full blast. Don't touch this... -DaveM
*
* Note with time_t changes to the timeval type, I must now use
* nucleus atomic quad 128-bit loads.
*/
sethi %hi(timer_tick_offset), %g3
sethi %hi(xtime), %g2
sethi %hi(timer_tick_compare), %g1
ldx [%g3 + %lo(timer_tick_offset)], %g3
or %g2, %lo(xtime), %g2
or %g1, %lo(timer_tick_compare), %g1
1: ldda [%g2] ASI_NUCLEUS_QUAD_LDD, %o4
rd %tick, %o1
ldx [%g1], %g7
ldda [%g2] ASI_NUCLEUS_QUAD_LDD, %o2
xor %o4, %o2, %o2
xor %o5, %o3, %o3
orcc %o2, %o3, %g0
bne,pn %xcc, 1b
sethi %hi(wall_jiffies), %o2
sethi %hi(jiffies), %o3
ldx [%o2 + %lo(wall_jiffies)], %o2
ldx [%o3 + %lo(jiffies)], %o3
sub %o3, %o2, %o2
sethi %hi(timer_ticks_per_usec_quotient), %o3
add %g3, %o1, %o1
ldx [%o3 + %lo(timer_ticks_per_usec_quotient)], %o3
sub %o1, %g7, %o1
mulx %o3, %o1, %o1
brz,pt %o2, 1f
srlx %o1, 32, %o1
sethi %hi(10000), %g2
or %g2, %lo(10000), %g2
add %o1, %g2, %o1
1: sethi %hi(1000000), %o2
srlx %o5, 32, %o5
or %o2, %lo(1000000), %o2
add %o5, %o1, %o5
cmp %o5, %o2
bl,a,pn %xcc, 1f
stx %o4, [%o0 + 0x0]
add %o4, 0x1, %o4
sub %o5, %o2, %o5
stx %o4, [%o0 + 0x0]
1: retl
st %o5, [%o0 + 0x8]
/* $Id: power.c,v 1.6 2000/04/13 00:59:59 davem Exp $
/* $Id: power.c,v 1.8 2000/07/11 22:41:33 davem Exp $
* power.c: Power management driver.
*
* Copyright (C) 1999 David S. Miller (davem@redhat.com)
......@@ -35,10 +35,12 @@ static void power_handler(int irq, void *dev_id, struct pt_regs *regs)
extern void machine_halt(void);
extern int serial_console;
void machine_power_off(void)
{
#ifdef CONFIG_PCI
if (power_reg != 0UL) {
if (power_reg != 0UL && !serial_console) {
/* Both register bits seem to have the
* same effect, so until I figure out
* what the difference is...
......@@ -53,7 +55,7 @@ void machine_power_off(void)
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 };
char *argv[] = { "/sbin/shutdown", "-h", "now", NULL };
daemonize();
sprintf(current->comm, "powerd");
......@@ -67,7 +69,7 @@ static int powerd(void *__unused)
}
/* Ok, down we go... */
if (execve("/usr/bin/shutdown", argv, envp) < 0) {
if (execve("/sbin/shutdown", argv, envp) < 0) {
printk("powerd: shutdown execution failed\n");
button_pressed = 0;
goto again;
......
/* $Id: process.c,v 1.108 2000/06/30 10:18:38 davem Exp $
/* $Id: process.c,v 1.109 2000/07/11 01:38:57 davem Exp $
* arch/sparc64/kernel/process.c
*
* Copyright (C) 1995, 1996 David S. Miller (davem@caip.rutgers.edu)
......
/* $Id: time.c,v 1.26 2000/05/09 17:40:14 davem Exp $
/* $Id: time.c,v 1.28 2000/07/11 02:21:12 davem Exp $
* time.c: UltraSparc timer and TOD clock support.
*
* Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
......@@ -46,8 +46,8 @@ static int set_rtc_mmss(unsigned long);
* interrupts, one at level14 and one with softint bit 0.
*/
unsigned long timer_tick_offset;
static unsigned long timer_tick_compare;
static unsigned long timer_ticks_per_usec_quotient;
unsigned long timer_tick_compare;
unsigned long timer_ticks_per_usec_quotient;
static __inline__ void timer_check_rtc(void)
{
......@@ -502,58 +502,6 @@ static __inline__ unsigned long do_gettimeoffset(void)
return (ticks * timer_ticks_per_usec_quotient) >> 32UL;
}
/* This need not obtain the xtime_lock as it is coded in
* an implicitly SMP safe way already.
*/
void do_gettimeofday(struct timeval *tv)
{
/* Load doubles must be used on xtime so that what we get
* is guarenteed to be atomic, this is why we can run this
* with interrupts on full blast. Don't touch this... -DaveM
*
* Note with time_t changes to the timeval type, I must now use
* nucleus atomic quad 128-bit loads.
*/
__asm__ __volatile__("
sethi %hi(timer_tick_offset), %g3
sethi %hi(xtime), %g2
sethi %hi(timer_tick_compare), %g1
ldx [%g3 + %lo(timer_tick_offset)], %g3
or %g2, %lo(xtime), %g2
or %g1, %lo(timer_tick_compare), %g1
1: ldda [%g2] 0x24, %o4
rd %tick, %o1
ldx [%g1], %g7
ldda [%g2] 0x24, %o2
xor %o4, %o2, %o2
xor %o5, %o3, %o3
orcc %o2, %o3, %g0
bne,pn %xcc, 1b
sethi %hi(lost_ticks), %o2
sethi %hi(timer_ticks_per_usec_quotient), %o3
ldx [%o2 + %lo(lost_ticks)], %o2
add %g3, %o1, %o1
ldx [%o3 + %lo(timer_ticks_per_usec_quotient)], %o3
sub %o1, %g7, %o1
mulx %o3, %o1, %o1
brz,pt %o2, 1f
srlx %o1, 32, %o1
sethi %hi(10000), %g2
or %g2, %lo(10000), %g2
add %o1, %g2, %o1
1: sethi %hi(1000000), %o2
srlx %o5, 32, %o5
or %o2, %lo(1000000), %o2
add %o5, %o1, %o5
cmp %o5, %o2
bl,a,pn %xcc, 1f
stx %o4, [%o0 + 0x0]
add %o4, 0x1, %o4
sub %o5, %o2, %o5
stx %o4, [%o0 + 0x0]
1: st %o5, [%o0 + 0x8]");
}
void do_settimeofday(struct timeval *tv)
{
write_lock_irq(&xtime_lock);
......
/* $Id: ptifddi.c,v 1.12 2000/06/19 06:24:46 davem Exp $
/* $Id: ptifddi.c,v 1.13 2000/07/11 22:35:22 davem Exp $
* ptifddi.c: Network driver for Performance Technologies single-attach
* and dual-attach FDDI sbus cards.
*
......
/* $Id: sunbmac.c,v 1.19 2000/06/19 06:24:46 davem Exp $
/* $Id: sunbmac.c,v 1.20 2000/07/11 22:35:22 davem Exp $
* sunbmac.c: Driver for Sparc BigMAC 100baseT ethernet adapters.
*
* Copyright (C) 1997, 1998, 1999 David S. Miller (davem@redhat.com)
......
/* $Id: sunbmac.h,v 1.6 2000/02/09 11:15:36 davem Exp $
/* $Id: sunbmac.h,v 1.7 2000/07/11 22:35:22 davem Exp $
* sunbmac.h: Defines for the Sun "Big MAC" 100baseT ethernet cards.
*
* Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
......
......@@ -30,7 +30,7 @@ static struct fbcon_font_desc *fbcon_fonts[] = {
&font_vga_8x16,
#endif
#ifdef CONFIG_FONT_6x11
#if defined(CONFIG_MAC) || defined(CONFIG_FB_SBUS)
#if defined(CONFIG_FBCON_MAC) || defined(CONFIG_FB_SBUS)
#undef NO_FONTS
#endif
&font_vga_6x11,
......
......@@ -220,7 +220,7 @@ static unsigned long load_elf_interp(struct elfhdr * interp_elf_ex,
if (interp_elf_ex->e_type != ET_EXEC &&
interp_elf_ex->e_type != ET_DYN)
goto out;
if (!elf_check_arch(interp_elf_ex->e_machine))
if (!elf_check_arch(interp_elf_ex))
goto out;
if (!interpreter->f_op->mmap)
goto out;
......@@ -405,23 +405,8 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
if (elf_ex.e_type != ET_EXEC && elf_ex.e_type != ET_DYN)
goto out;
if (!elf_check_arch(elf_ex.e_machine))
if (!elf_check_arch(&elf_ex))
goto out;
#if defined(__mips__) && !defined(__mips64)
/* IRIX5 binaries handled elsewhere. */
if (elf_ex.e_flags & EF_MIPS_ARCH) {
retval = -ENOEXEC;
goto out;
}
#endif
#if defined(__mips__) && defined(__mips64)
/* Linux/MIPS 32-bit binaries handled elsewhere. */
if (sizeof(elf_caddr_t) == 8 &&
elf_ex.e_ident[EI_CLASS] == ELFCLASS32) {
retval = -ENOEXEC;
goto out;
}
#endif
if (!bprm->file->f_op||!bprm->file->f_op->mmap)
goto out;
......@@ -794,7 +779,7 @@ static int load_elf_library(struct file *file)
/* First of all, some simple consistency checks */
if (elf_ex.e_type != ET_EXEC || elf_ex.e_phnum > 2 ||
!elf_check_arch(elf_ex.e_machine) || !file->f_op->mmap)
!elf_check_arch(&elf_ex) || !file->f_op->mmap)
goto out;
/* Now read in all of the header information */
......
......@@ -22,7 +22,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
/*
* This is used to ensure we don't load something for the wrong architecture.
*/
#define elf_check_arch(x) ((x) == EM_ALPHA)
#define elf_check_arch(x) ((x)->e_machine == EM_ALPHA)
/*
* These are used to set parameters in the core dumps.
......
......@@ -19,7 +19,8 @@ typedef struct user_fxsr_struct elf_fpxregset_t;
/*
* This is used to ensure we don't load something for the wrong architecture.
*/
#define elf_check_arch(x) ( ((x) == EM_386) || ((x) == EM_486) )
#define elf_check_arch(x) \
(((x)->e_machine == EM_386) || ((x)->e_machine == EM_486))
/*
* These are used to set parameters in the core dumps.
......
......@@ -14,7 +14,7 @@
/*
* This is used to ensure we don't load something for the wrong architecture.
*/
#define elf_check_arch(x) ((x) == EM_IA_64)
#define elf_check_arch(x) ((x)->e_machine == EM_IA_64)
/*
* These are used to set parameters in the core dumps.
......
......@@ -19,7 +19,7 @@ typedef struct user_m68kfp_struct elf_fpregset_t;
/*
* This is used to ensure we don't load something for the wrong architecture.
*/
#define elf_check_arch(x) ((x) == EM_68K)
#define elf_check_arch(x) ((x)->e_machine == EM_68K)
/*
* These are used to set parameters in the core dumps.
......
......@@ -15,9 +15,33 @@ typedef double elf_fpreg_t;
typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
/*
* This is used to ensure we don't load something for the wrong architecture.
* This is used to ensure we don't load something for the wrong architecture
* and also rejects IRIX binaries.
*/
#define elf_check_arch(x) ((x) == EM_MIPS || (x) == EM_MIPS_RS4_BE)
#define elf_check_arch(hdr) \
({ \
int __res = 0; \
struct elfhdr *__h = (hdr); \
\
if ((__h->e_machine != EM_MIPS) && (__h->e_machine != EM_MIPS)) \
__res = -ENOEXEC; \
if (__h->e_flags & EF_MIPS_ARCH) \
__res = -ENOEXEC; \
\
__res; \
})
/* This one accepts IRIX binaries. */
#define irix_elf_check_arch(hdr) \
({ \
int __res = 0; \
struct elfhdr *__h = (hdr); \
\
if ((__h->e_machine != EM_MIPS) && (__h->e_machine != EM_MIPS)) \
__res = -ENOEXEC; \
\
__res; \
})
/*
* These are used to set parameters in the core dumps.
......
/* $Id: elf.h,v 1.3 2000/01/17 23:32:47 ralf Exp $
*
/*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
......@@ -22,9 +21,22 @@ typedef double elf_fpreg_t;
typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
/*
* This is used to ensure we don't load something for the wrong architecture.
* This is used to ensure we don't load something for the wrong
* architecture or OS.
*/
#define elf_check_arch(x) ((x) == EM_MIPS || (x) == EM_MIPS_RS4_BE)
#define elf_check_arch(hdr) \
({ \
int __res = 0; \
struct elfhdr *__h = (hdr); \
\
if ((__h->e_machine != EM_MIPS) && (__h->e_machine != EM_MIPS)) \
__res = -ENOEXEC; \
if (sizeof(elf_caddr_t) == 8 && \
__h->e_ident[EI_CLASS] == ELFCLASS32) \
__res = -ENOEXEC; \
\
__res; \
})
/*
* These are used to set parameters in the core dumps.
......
......@@ -13,7 +13,7 @@
/*
* This is used to ensure we don't load something for the wrong architecture.
*/
#define elf_check_arch(x) ((x) == EM_PPC)
#define elf_check_arch(x) ((x)->e_machine == EM_PPC)
/*
* These are used to set parameters in the core dumps.
......
......@@ -22,7 +22,7 @@ typedef s390_regs elf_gregset_t;
/*
* This is used to ensure we don't load something for the wrong architecture.
*/
#define elf_check_arch(x) ((x) == EM_S390)
#define elf_check_arch(x) ((x)->elf_machine == EM_S390)
/*
* These are used to set parameters in the core dumps.
......
......@@ -19,7 +19,7 @@ typedef struct user_fpu_struct elf_fpregset_t;
/*
* This is used to ensure we don't load something for the wrong architecture.
*/
#define elf_check_arch(x) ( (x) == EM_SH )
#define elf_check_arch(x) ( (x)->e_machine == EM_SH )
/*
* These are used to set parameters in the core dumps.
......
This diff is collapsed.
......@@ -59,7 +59,7 @@ typedef struct {
/*
* This is used to ensure we don't load something for the wrong architecture.
*/
#define elf_check_arch(x) ((x) == EM_SPARC)
#define elf_check_arch(x) ((x)->e_machine == EM_SPARC)
/*
* These are used to set parameters in the core dumps.
......
This diff is collapsed.
......@@ -36,7 +36,7 @@ typedef struct {
* This is used to ensure we don't load something for the wrong architecture.
*/
#ifndef elf_check_arch
#define elf_check_arch(x) ((x) == ELF_ARCH) /* Might be EM_SPARCV9 or EM_SPARC */
#define elf_check_arch(x) ((x)->e_machine == ELF_ARCH) /* Might be EM_SPARCV9 or EM_SPARC */
#endif
#define USE_ELF_CORE_DUMP
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment