diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2005-10-12 23:40:54 -0400 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2005-10-12 23:40:54 -0400 |
commit | d4bf9a7858a0766cafb21dcb66ff9a5d92c1cd09 (patch) | |
tree | 7179d40fa2b016414fb2b7fcc9e9da960459bc8d /arch/powerpc/kernel | |
parent | 0f17d0742f27b7a69b0e2dfb21190f06ea3a9087 (diff) |
ppc64: merge binfmt_elf32.c
and use start_thread for both 32 and 64 bit bineries.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r-- | arch/powerpc/kernel/Makefile | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/binfmt_elf32.c | 75 | ||||
-rw-r--r-- | arch/powerpc/kernel/process.c | 6 |
3 files changed, 81 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index f03f6d4ffaa6..adac749a1a8a 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile | |||
@@ -11,6 +11,7 @@ CFLAGS_btext.o += -fPIC | |||
11 | endif | 11 | endif |
12 | 12 | ||
13 | obj-y := semaphore.o cputable.o | 13 | obj-y := semaphore.o cputable.o |
14 | obj-$(CONFIG_PPC64) += binfmt_elf32.o | ||
14 | obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o | 15 | obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o |
15 | obj-$(CONFIG_POWER4) += idle_power4.o | 16 | obj-$(CONFIG_POWER4) += idle_power4.o |
16 | 17 | ||
diff --git a/arch/powerpc/kernel/binfmt_elf32.c b/arch/powerpc/kernel/binfmt_elf32.c new file mode 100644 index 000000000000..8ad6b0f33651 --- /dev/null +++ b/arch/powerpc/kernel/binfmt_elf32.c | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * binfmt_elf32.c: Support 32-bit PPC ELF binaries on Power3 and followons. | ||
3 | * based on the SPARC64 version. | ||
4 | * Copyright (C) 1995, 1996, 1997, 1998 David S. Miller (davem@redhat.com) | ||
5 | * Copyright (C) 1995, 1996, 1997, 1998 Jakub Jelinek (jj@ultra.linux.cz) | ||
6 | * | ||
7 | * Copyright (C) 2000,2001 Ken Aaker (kdaaker@rchland.vnet.ibm.com), IBM Corp | ||
8 | * Copyright (C) 2001 Anton Blanchard (anton@au.ibm.com), IBM | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or | ||
11 | * modify it under the terms of the GNU General Public License | ||
12 | * as published by the Free Software Foundation; either version | ||
13 | * 2 of the License, or (at your option) any later version. | ||
14 | */ | ||
15 | |||
16 | #define ELF_ARCH EM_PPC | ||
17 | #define ELF_CLASS ELFCLASS32 | ||
18 | #define ELF_DATA ELFDATA2MSB; | ||
19 | |||
20 | #include <asm/processor.h> | ||
21 | #include <linux/module.h> | ||
22 | #include <linux/config.h> | ||
23 | #include <linux/elfcore.h> | ||
24 | #include <linux/compat.h> | ||
25 | |||
26 | #define elf_prstatus elf_prstatus32 | ||
27 | struct elf_prstatus32 | ||
28 | { | ||
29 | struct elf_siginfo pr_info; /* Info associated with signal */ | ||
30 | short pr_cursig; /* Current signal */ | ||
31 | unsigned int pr_sigpend; /* Set of pending signals */ | ||
32 | unsigned int pr_sighold; /* Set of held signals */ | ||
33 | pid_t pr_pid; | ||
34 | pid_t pr_ppid; | ||
35 | pid_t pr_pgrp; | ||
36 | pid_t pr_sid; | ||
37 | struct compat_timeval pr_utime; /* User time */ | ||
38 | struct compat_timeval pr_stime; /* System time */ | ||
39 | struct compat_timeval pr_cutime; /* Cumulative user time */ | ||
40 | struct compat_timeval pr_cstime; /* Cumulative system time */ | ||
41 | elf_gregset_t pr_reg; /* General purpose registers. */ | ||
42 | int pr_fpvalid; /* True if math co-processor being used. */ | ||
43 | }; | ||
44 | |||
45 | #define elf_prpsinfo elf_prpsinfo32 | ||
46 | struct elf_prpsinfo32 | ||
47 | { | ||
48 | char pr_state; /* numeric process state */ | ||
49 | char pr_sname; /* char for pr_state */ | ||
50 | char pr_zomb; /* zombie */ | ||
51 | char pr_nice; /* nice val */ | ||
52 | unsigned int pr_flag; /* flags */ | ||
53 | u32 pr_uid; | ||
54 | u32 pr_gid; | ||
55 | pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid; | ||
56 | /* Lots missing */ | ||
57 | char pr_fname[16]; /* filename of executable */ | ||
58 | char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ | ||
59 | }; | ||
60 | |||
61 | #include <linux/time.h> | ||
62 | |||
63 | #undef cputime_to_timeval | ||
64 | #define cputime_to_timeval cputime_to_compat_timeval | ||
65 | static __inline__ void | ||
66 | cputime_to_compat_timeval(const cputime_t cputime, struct compat_timeval *value) | ||
67 | { | ||
68 | unsigned long jiffies = cputime_to_jiffies(cputime); | ||
69 | value->tv_usec = (jiffies % HZ) * (1000000L / HZ); | ||
70 | value->tv_sec = jiffies / HZ; | ||
71 | } | ||
72 | |||
73 | #define init_elf_binfmt init_elf32_binfmt | ||
74 | |||
75 | #include "../../../fs/binfmt_elf.c" | ||
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 92bc75f61ca6..193c8c1bf132 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -620,7 +620,7 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp) | |||
620 | regs->nip = start; | 620 | regs->nip = start; |
621 | regs->msr = MSR_USER; | 621 | regs->msr = MSR_USER; |
622 | #else | 622 | #else |
623 | { | 623 | if (!test_thread_flag(TIF_32BIT)) { |
624 | unsigned long entry, toc, load_addr = regs->gpr[2]; | 624 | unsigned long entry, toc, load_addr = regs->gpr[2]; |
625 | 625 | ||
626 | /* start is a relocated pointer to the function descriptor for | 626 | /* start is a relocated pointer to the function descriptor for |
@@ -641,6 +641,10 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp) | |||
641 | regs->nip = entry; | 641 | regs->nip = entry; |
642 | regs->gpr[2] = toc; | 642 | regs->gpr[2] = toc; |
643 | regs->msr = MSR_USER64; | 643 | regs->msr = MSR_USER64; |
644 | } else { | ||
645 | regs->nip = start; | ||
646 | regs->gpr[2] = 0; | ||
647 | regs->msr = MSR_USER32; | ||
644 | } | 648 | } |
645 | #endif | 649 | #endif |
646 | 650 | ||