| 
									
										
										
										
											2008-02-08 04:19:28 -08:00
										 |  |  | /* a.out coredump register dumper
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | 
					
						
							|  |  |  |  * Written by David Howells (dhowells@redhat.com) | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  * modify it under the terms of the GNU General Public Licence | 
					
						
							|  |  |  |  * as published by the Free Software Foundation; either version | 
					
						
							|  |  |  |  * 2 of the Licence, or (at your option) any later version. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-10-22 22:26:29 -07:00
										 |  |  | #ifndef _ASM_X86_A_OUT_CORE_H
 | 
					
						
							|  |  |  | #define _ASM_X86_A_OUT_CORE_H
 | 
					
						
							| 
									
										
										
										
											2008-02-08 04:19:28 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifdef __KERNEL__
 | 
					
						
							|  |  |  | #ifdef CONFIG_X86_32
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <linux/user.h>
 | 
					
						
							|  |  |  | #include <linux/elfcore.h>
 | 
					
						
							| 
									
										
										
										
											2009-11-09 21:03:43 +01:00
										 |  |  | #include <asm/debugreg.h>
 | 
					
						
							| 
									
										
										
										
											2008-02-08 04:19:28 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * fill in the user structure for an a.out core dump | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static inline void aout_dump_thread(struct pt_regs *regs, struct user *dump) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | /* changed the size calculations - should hopefully work better. lbt */ | 
					
						
							|  |  |  | 	dump->magic = CMAGIC; | 
					
						
							|  |  |  | 	dump->start_code = 0; | 
					
						
							|  |  |  | 	dump->start_stack = regs->sp & ~(PAGE_SIZE - 1); | 
					
						
							| 
									
										
										
										
											2008-03-23 01:01:38 -07:00
										 |  |  | 	dump->u_tsize = ((unsigned long)current->mm->end_code) >> PAGE_SHIFT; | 
					
						
							|  |  |  | 	dump->u_dsize = ((unsigned long)(current->mm->brk + (PAGE_SIZE - 1))) | 
					
						
							|  |  |  | 			>> PAGE_SHIFT; | 
					
						
							| 
									
										
										
										
											2008-02-08 04:19:28 -08:00
										 |  |  | 	dump->u_dsize -= dump->u_tsize; | 
					
						
							|  |  |  | 	dump->u_ssize = 0; | 
					
						
							| 
									
										
										
										
											2009-11-09 21:03:43 +01:00
										 |  |  | 	aout_dump_debugregs(dump); | 
					
						
							| 
									
										
										
										
											2008-02-08 04:19:28 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	if (dump->start_stack < TASK_SIZE) | 
					
						
							| 
									
										
										
										
											2008-03-23 01:01:38 -07:00
										 |  |  | 		dump->u_ssize = ((unsigned long)(TASK_SIZE - dump->start_stack)) | 
					
						
							|  |  |  | 				>> PAGE_SHIFT; | 
					
						
							| 
									
										
										
										
											2008-02-08 04:19:28 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	dump->regs.bx = regs->bx; | 
					
						
							|  |  |  | 	dump->regs.cx = regs->cx; | 
					
						
							|  |  |  | 	dump->regs.dx = regs->dx; | 
					
						
							|  |  |  | 	dump->regs.si = regs->si; | 
					
						
							|  |  |  | 	dump->regs.di = regs->di; | 
					
						
							|  |  |  | 	dump->regs.bp = regs->bp; | 
					
						
							|  |  |  | 	dump->regs.ax = regs->ax; | 
					
						
							|  |  |  | 	dump->regs.ds = (u16)regs->ds; | 
					
						
							|  |  |  | 	dump->regs.es = (u16)regs->es; | 
					
						
							|  |  |  | 	dump->regs.fs = (u16)regs->fs; | 
					
						
							| 
									
										
										
										
											2009-02-09 22:17:40 +09:00
										 |  |  | 	dump->regs.gs = get_user_gs(regs); | 
					
						
							| 
									
										
										
										
											2008-02-08 04:19:28 -08:00
										 |  |  | 	dump->regs.orig_ax = regs->orig_ax; | 
					
						
							|  |  |  | 	dump->regs.ip = regs->ip; | 
					
						
							|  |  |  | 	dump->regs.cs = (u16)regs->cs; | 
					
						
							|  |  |  | 	dump->regs.flags = regs->flags; | 
					
						
							|  |  |  | 	dump->regs.sp = regs->sp; | 
					
						
							|  |  |  | 	dump->regs.ss = (u16)regs->ss; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-03-23 01:01:38 -07:00
										 |  |  | 	dump->u_fpvalid = dump_fpu(regs, &dump->i387); | 
					
						
							| 
									
										
										
										
											2008-02-08 04:19:28 -08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif /* CONFIG_X86_32 */
 | 
					
						
							|  |  |  | #endif /* __KERNEL__ */
 | 
					
						
							| 
									
										
										
										
											2008-10-22 22:26:29 -07:00
										 |  |  | #endif /* _ASM_X86_A_OUT_CORE_H */
 |