Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[linux-2.6] / include / asm-m68k / a.out-core.h
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
17 #include <linux/user.h>
18 #include <linux/elfcore.h>
19
20 /*
21  * fill in the user structure for an a.out core dump
22  */
23 static inline void aout_dump_thread(struct pt_regs *regs, struct user *dump)
24 {
25         struct switch_stack *sw;
26
27 /* changed the size calculations - should hopefully work better. lbt */
28         dump->magic = CMAGIC;
29         dump->start_code = 0;
30         dump->start_stack = rdusp() & ~(PAGE_SIZE - 1);
31         dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT;
32         dump->u_dsize = ((unsigned long) (current->mm->brk +
33                                           (PAGE_SIZE-1))) >> PAGE_SHIFT;
34         dump->u_dsize -= dump->u_tsize;
35         dump->u_ssize = 0;
36
37         if (dump->start_stack < TASK_SIZE)
38                 dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT;
39
40         dump->u_ar0 = offsetof(struct user, regs);
41         sw = ((struct switch_stack *)regs) - 1;
42         dump->regs.d1 = regs->d1;
43         dump->regs.d2 = regs->d2;
44         dump->regs.d3 = regs->d3;
45         dump->regs.d4 = regs->d4;
46         dump->regs.d5 = regs->d5;
47         dump->regs.d6 = sw->d6;
48         dump->regs.d7 = sw->d7;
49         dump->regs.a0 = regs->a0;
50         dump->regs.a1 = regs->a1;
51         dump->regs.a2 = regs->a2;
52         dump->regs.a3 = sw->a3;
53         dump->regs.a4 = sw->a4;
54         dump->regs.a5 = sw->a5;
55         dump->regs.a6 = sw->a6;
56         dump->regs.d0 = regs->d0;
57         dump->regs.orig_d0 = regs->orig_d0;
58         dump->regs.stkadj = regs->stkadj;
59         dump->regs.sr = regs->sr;
60         dump->regs.pc = regs->pc;
61         dump->regs.fmtvec = (regs->format << 12) | regs->vector;
62         /* dump floating point stuff */
63         dump->u_fpvalid = dump_fpu (regs, &dump->m68kfp);
64 }
65
66 #endif /* __KERNEL__ */
67 #endif /* _ASM_A_OUT_CORE_H */