1 /* a.out coredump register dumper
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
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.
12 #ifndef _ASM_X86_A_OUT_CORE_H
13 #define _ASM_X86_A_OUT_CORE_H
18 #include <linux/user.h>
19 #include <linux/elfcore.h>
22 * fill in the user structure for an a.out core dump
24 static inline void aout_dump_thread(struct pt_regs
*regs
, struct user
*dump
)
26 /* changed the size calculations - should hopefully work better. lbt */
29 dump
->start_stack
= regs
->sp
& ~(PAGE_SIZE
- 1);
30 dump
->u_tsize
= ((unsigned long)current
->mm
->end_code
) >> PAGE_SHIFT
;
31 dump
->u_dsize
= ((unsigned long)(current
->mm
->brk
+ (PAGE_SIZE
- 1)))
33 dump
->u_dsize
-= dump
->u_tsize
;
35 dump
->u_debugreg
[0] = current
->thread
.debugreg0
;
36 dump
->u_debugreg
[1] = current
->thread
.debugreg1
;
37 dump
->u_debugreg
[2] = current
->thread
.debugreg2
;
38 dump
->u_debugreg
[3] = current
->thread
.debugreg3
;
39 dump
->u_debugreg
[4] = 0;
40 dump
->u_debugreg
[5] = 0;
41 dump
->u_debugreg
[6] = current
->thread
.debugreg6
;
42 dump
->u_debugreg
[7] = current
->thread
.debugreg7
;
44 if (dump
->start_stack
< TASK_SIZE
)
45 dump
->u_ssize
= ((unsigned long)(TASK_SIZE
- dump
->start_stack
))
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 dump
->regs
.gs
= get_user_gs(regs
);
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
;
66 dump
->u_fpvalid
= dump_fpu(regs
, &dump
->i387
);
69 #endif /* CONFIG_X86_32 */
70 #endif /* __KERNEL__ */
71 #endif /* _ASM_X86_A_OUT_CORE_H */