diff options
author | David Howells <dhowells@redhat.com> | 2008-02-08 07:19:28 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:30 -0500 |
commit | 7fa3031500ec9b0a7460c8c23751799006ffee74 (patch) | |
tree | 2a7e9202b35a39dc8217e95825263c0629e67e35 /include/asm-x86/a.out-core.h | |
parent | b0b933c08bd5fd053bbba8ba6387f543be03d49f (diff) |
aout: suppress A.OUT library support if !CONFIG_ARCH_SUPPORTS_AOUT
Suppress A.OUT library support if CONFIG_ARCH_SUPPORTS_AOUT is not set.
Not all architectures support the A.OUT binfmt, so the ELF binfmt should not
be permitted to go looking for A.OUT libraries to load in such a case. Not
only that, but under such conditions A.OUT core dumps are not produced either.
To make this work, this patch also does the following:
(1) Makes the existence of the contents of linux/a.out.h contingent on
CONFIG_ARCH_SUPPORTS_AOUT.
(2) Renames dump_thread() to aout_dump_thread() as it's only called by A.OUT
core dumping code.
(3) Moves aout_dump_thread() into asm/a.out-core.h and makes it inline. This
is then included only where needed. This means that this bit of arch
code will be stored in the appropriate A.OUT binfmt module rather than
the core kernel.
(4) Drops A.OUT support for Blackfin (according to Mike Frysinger it's not
needed) and FRV.
This patch depends on the previous patch to move STACK_TOP[_MAX] out of
asm/a.out.h and into asm/processor.h as they're required whether or not A.OUT
format is available.
[jdike@addtoit.com: uml: re-remove accidentally restored code]
Signed-off-by: David Howells <dhowells@redhat.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-x86/a.out-core.h')
-rw-r--r-- | include/asm-x86/a.out-core.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/include/asm-x86/a.out-core.h b/include/asm-x86/a.out-core.h new file mode 100644 index 000000000000..d2b6e11d3e97 --- /dev/null +++ b/include/asm-x86/a.out-core.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /* a.out coredump register dumper | ||
2 | * | ||
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_A_OUT_CORE_H | ||
13 | #define _ASM_A_OUT_CORE_H | ||
14 | |||
15 | #ifdef __KERNEL__ | ||
16 | #ifdef CONFIG_X86_32 | ||
17 | |||
18 | #include <linux/user.h> | ||
19 | #include <linux/elfcore.h> | ||
20 | |||
21 | /* | ||
22 | * fill in the user structure for an a.out core dump | ||
23 | */ | ||
24 | static inline void aout_dump_thread(struct pt_regs *regs, struct user *dump) | ||
25 | { | ||
26 | u16 gs; | ||
27 | |||
28 | /* changed the size calculations - should hopefully work better. lbt */ | ||
29 | dump->magic = CMAGIC; | ||
30 | dump->start_code = 0; | ||
31 | dump->start_stack = regs->sp & ~(PAGE_SIZE - 1); | ||
32 | dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT; | ||
33 | dump->u_dsize = ((unsigned long) (current->mm->brk + (PAGE_SIZE-1))) >> PAGE_SHIFT; | ||
34 | dump->u_dsize -= dump->u_tsize; | ||
35 | dump->u_ssize = 0; | ||
36 | dump->u_debugreg[0] = current->thread.debugreg0; | ||
37 | dump->u_debugreg[1] = current->thread.debugreg1; | ||
38 | dump->u_debugreg[2] = current->thread.debugreg2; | ||
39 | dump->u_debugreg[3] = current->thread.debugreg3; | ||
40 | dump->u_debugreg[4] = 0; | ||
41 | dump->u_debugreg[5] = 0; | ||
42 | dump->u_debugreg[6] = current->thread.debugreg6; | ||
43 | dump->u_debugreg[7] = current->thread.debugreg7; | ||
44 | |||
45 | if (dump->start_stack < TASK_SIZE) | ||
46 | dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT; | ||
47 | |||
48 | dump->regs.bx = regs->bx; | ||
49 | dump->regs.cx = regs->cx; | ||
50 | dump->regs.dx = regs->dx; | ||
51 | dump->regs.si = regs->si; | ||
52 | dump->regs.di = regs->di; | ||
53 | dump->regs.bp = regs->bp; | ||
54 | dump->regs.ax = regs->ax; | ||
55 | dump->regs.ds = (u16)regs->ds; | ||
56 | dump->regs.es = (u16)regs->es; | ||
57 | dump->regs.fs = (u16)regs->fs; | ||
58 | savesegment(gs,gs); | ||
59 | dump->regs.orig_ax = regs->orig_ax; | ||
60 | dump->regs.ip = regs->ip; | ||
61 | dump->regs.cs = (u16)regs->cs; | ||
62 | dump->regs.flags = regs->flags; | ||
63 | dump->regs.sp = regs->sp; | ||
64 | dump->regs.ss = (u16)regs->ss; | ||
65 | |||
66 | dump->u_fpvalid = dump_fpu (regs, &dump->i387); | ||
67 | } | ||
68 | |||
69 | #endif /* CONFIG_X86_32 */ | ||
70 | #endif /* __KERNEL__ */ | ||
71 | #endif /* _ASM_A_OUT_CORE_H */ | ||