a.out-core.h 2.0 KB

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