a.out-core.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. /*
  16. * fill in the user structure for an a.out core dump
  17. */
  18. static inline void aout_dump_thread(struct pt_regs *regs, struct user *dump)
  19. {
  20. unsigned long first_stack_page;
  21. dump->magic = SUNOS_CORE_MAGIC;
  22. dump->len = sizeof(struct user);
  23. dump->regs.psr = regs->psr;
  24. dump->regs.pc = regs->pc;
  25. dump->regs.npc = regs->npc;
  26. dump->regs.y = regs->y;
  27. /* fuck me plenty */
  28. memcpy(&dump->regs.regs[0], &regs->u_regs[1], (sizeof(unsigned long) * 15));
  29. dump->uexec = current->thread.core_exec;
  30. dump->u_tsize = (((unsigned long) current->mm->end_code) -
  31. ((unsigned long) current->mm->start_code)) & ~(PAGE_SIZE - 1);
  32. dump->u_dsize = ((unsigned long) (current->mm->brk + (PAGE_SIZE-1)));
  33. dump->u_dsize -= dump->u_tsize;
  34. dump->u_dsize &= ~(PAGE_SIZE - 1);
  35. first_stack_page = (regs->u_regs[UREG_FP] & ~(PAGE_SIZE - 1));
  36. dump->u_ssize = (TASK_SIZE - first_stack_page) & ~(PAGE_SIZE - 1);
  37. memcpy(&dump->fpu.fpstatus.fregs.regs[0], &current->thread.float_regs[0], (sizeof(unsigned long) * 32));
  38. dump->fpu.fpstatus.fsr = current->thread.fsr;
  39. dump->fpu.fpstatus.flags = dump->fpu.fpstatus.extra = 0;
  40. dump->fpu.fpstatus.fpq_count = current->thread.fpqdepth;
  41. memcpy(&dump->fpu.fpstatus.fpq[0], &current->thread.fpqueue[0],
  42. ((sizeof(unsigned long) * 2) * 16));
  43. dump->sigcode = 0;
  44. }
  45. #endif /* __KERNEL__ */
  46. #endif /* _ASM_A_OUT_CORE_H */