linux/arch/alpha/include/asm/a.out-core.h
<<
>>
Prefs
   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
  19/*
  20 * Fill in the user structure for an ECOFF core dump.
  21 */
  22static inline void aout_dump_thread(struct pt_regs *pt, struct user *dump)
  23{
  24        /* switch stack follows right below pt_regs: */
  25        struct switch_stack * sw = ((struct switch_stack *) pt) - 1;
  26
  27        dump->magic = CMAGIC;
  28        dump->start_code  = current->mm->start_code;
  29        dump->start_data  = current->mm->start_data;
  30        dump->start_stack = rdusp() & ~(PAGE_SIZE - 1);
  31        dump->u_tsize = ((current->mm->end_code - dump->start_code)
  32                         >> PAGE_SHIFT);
  33        dump->u_dsize = ((current->mm->brk + PAGE_SIZE-1 - dump->start_data)
  34                         >> PAGE_SHIFT);
  35        dump->u_ssize = (current->mm->start_stack - dump->start_stack
  36                         + PAGE_SIZE-1) >> PAGE_SHIFT;
  37
  38        /*
  39         * We store the registers in an order/format that is
  40         * compatible with DEC Unix/OSF/1 as this makes life easier
  41         * for gdb.
  42         */
  43        dump->regs[EF_V0]  = pt->r0;
  44        dump->regs[EF_T0]  = pt->r1;
  45        dump->regs[EF_T1]  = pt->r2;
  46        dump->regs[EF_T2]  = pt->r3;
  47        dump->regs[EF_T3]  = pt->r4;
  48        dump->regs[EF_T4]  = pt->r5;
  49        dump->regs[EF_T5]  = pt->r6;
  50        dump->regs[EF_T6]  = pt->r7;
  51        dump->regs[EF_T7]  = pt->r8;
  52        dump->regs[EF_S0]  = sw->r9;
  53        dump->regs[EF_S1]  = sw->r10;
  54        dump->regs[EF_S2]  = sw->r11;
  55        dump->regs[EF_S3]  = sw->r12;
  56        dump->regs[EF_S4]  = sw->r13;
  57        dump->regs[EF_S5]  = sw->r14;
  58        dump->regs[EF_S6]  = sw->r15;
  59        dump->regs[EF_A3]  = pt->r19;
  60        dump->regs[EF_A4]  = pt->r20;
  61        dump->regs[EF_A5]  = pt->r21;
  62        dump->regs[EF_T8]  = pt->r22;
  63        dump->regs[EF_T9]  = pt->r23;
  64        dump->regs[EF_T10] = pt->r24;
  65        dump->regs[EF_T11] = pt->r25;
  66        dump->regs[EF_RA]  = pt->r26;
  67        dump->regs[EF_T12] = pt->r27;
  68        dump->regs[EF_AT]  = pt->r28;
  69        dump->regs[EF_SP]  = rdusp();
  70        dump->regs[EF_PS]  = pt->ps;
  71        dump->regs[EF_PC]  = pt->pc;
  72        dump->regs[EF_GP]  = pt->gp;
  73        dump->regs[EF_A0]  = pt->r16;
  74        dump->regs[EF_A1]  = pt->r17;
  75        dump->regs[EF_A2]  = pt->r18;
  76        memcpy((char *)dump->regs + EF_SIZE, sw->fp, 32 * 8);
  77}
  78
  79#endif /* __KERNEL__ */
  80#endif /* _ASM_A_OUT_CORE_H */
  81