ia64/xen-unstable

changeset 16005:83239b289072

[IA64] Kexec: Implement elf_core_save_regs()

Implement elf_core_save_regs() by porting (un #ifdefing)
ia64_elf_core_copy_regs() from Linux.

This ommits the calls to ia64_get_user_rbs_end() and ia64_sync_user_rbs()
in do_copy_task_regs(). Supplying them would seem to involve a reasonably
involved ammount of porting. I'm really not sure that its neccessary.

Signed-off-by: Simon Horman <horms@verge.net.au>
author Alex Williamson <alex.williamson@hp.com>
date Thu Sep 27 16:29:43 2007 -0600 (2007-09-27)
parents cbe97b8802e9
children 5c56ce7b9892
files xen/arch/ia64/linux-xen/process-linux-xen.c xen/include/asm-ia64/elf.h
line diff
     1.1 --- a/xen/arch/ia64/linux-xen/process-linux-xen.c	Thu Sep 27 16:26:34 2007 -0600
     1.2 +++ b/xen/arch/ia64/linux-xen/process-linux-xen.c	Thu Sep 27 16:29:43 2007 -0600
     1.3 @@ -13,6 +13,7 @@
     1.4  #include <xen/symbols.h>
     1.5  #include <xen/smp.h>
     1.6  #include <xen/sched.h>
     1.7 +#include <asm/elf.h>
     1.8  #include <asm/uaccess.h>
     1.9  #include <asm/processor.h>
    1.10  #include <asm/ptrace.h>
    1.11 @@ -542,6 +543,8 @@ copy_thread (int nr, unsigned long clone
    1.12  	return retval;
    1.13  }
    1.14  
    1.15 +#endif /* !XEN */
    1.16 +
    1.17  static void
    1.18  do_copy_task_regs (struct task_struct *task, struct unw_frame_info *info, void *arg)
    1.19  {
    1.20 @@ -559,10 +562,14 @@ do_copy_task_regs (struct task_struct *t
    1.21  	unw_get_sp(info, &sp);
    1.22  	pt = (struct pt_regs *) (sp + 16);
    1.23  
    1.24 +#ifndef XEN
    1.25 +	/* FIXME: Is this needed by XEN when it makes its crash notes
    1.26 +	 * during kdump? */
    1.27  	urbs_end = ia64_get_user_rbs_end(task, pt, &cfm);
    1.28  
    1.29  	if (ia64_sync_user_rbs(task, info->sw, pt->ar_bspstore, urbs_end) < 0)
    1.30  		return;
    1.31 +#endif /* !XEN */
    1.32  
    1.33  	ia64_peek(task, info->sw, urbs_end, (long) ia64_rse_rnat_addr((long *) urbs_end),
    1.34  		  &ar_rnat);
    1.35 @@ -614,6 +621,8 @@ do_copy_task_regs (struct task_struct *t
    1.36  	unw_get_ar(info, UNW_AR_SSD, &dst[56]);
    1.37  }
    1.38  
    1.39 +#ifndef XEN
    1.40 +
    1.41  void
    1.42  do_dump_task_fpu (struct task_struct *task, struct unw_frame_info *info, void *arg)
    1.43  {
    1.44 @@ -635,12 +644,16 @@ do_dump_task_fpu (struct task_struct *ta
    1.45  		memcpy(dst + 32, task->thread.fph, 96*16);
    1.46  }
    1.47  
    1.48 +#endif /* !XEN */
    1.49 +
    1.50  void
    1.51  do_copy_regs (struct unw_frame_info *info, void *arg)
    1.52  {
    1.53  	do_copy_task_regs(current, info, arg);
    1.54  }
    1.55  
    1.56 +#ifndef XEN
    1.57 +
    1.58  void
    1.59  do_dump_fpu (struct unw_frame_info *info, void *arg)
    1.60  {
    1.61 @@ -662,12 +675,16 @@ dump_task_regs(struct task_struct *task,
    1.62  	return 1;
    1.63  }
    1.64  
    1.65 +#endif /* !XEN */
    1.66 +
    1.67  void
    1.68  ia64_elf_core_copy_regs (struct pt_regs *pt, elf_gregset_t dst)
    1.69  {
    1.70  	unw_init_running(do_copy_regs, dst);
    1.71  }
    1.72  
    1.73 +#ifndef XEN
    1.74 +
    1.75  int
    1.76  dump_task_fpu (struct task_struct *task, elf_fpregset_t *dst)
    1.77  {
     2.1 --- a/xen/include/asm-ia64/elf.h	Thu Sep 27 16:26:34 2007 -0600
     2.2 +++ b/xen/include/asm-ia64/elf.h	Thu Sep 27 16:29:43 2007 -0600
     2.3 @@ -1,8 +1,6 @@
     2.4  #ifndef __IA64_ELF_H__
     2.5  #define __IA64_ELF_H__
     2.6  
     2.7 -#include <xen/lib.h>       /* for printk() used in stub */
     2.8 -
     2.9  typedef struct {
    2.10      unsigned long r1;
    2.11      unsigned long r2;
    2.12 @@ -20,14 +18,29 @@ typedef struct {
    2.13      unsigned long ar_ssd;
    2.14  } ELF_Gregset;
    2.15  
    2.16 -typedef struct {
    2.17 -    unsigned long dummy;
    2.18 -} crash_xen_core_t;
    2.19 +/*
    2.20 + * elf_gregset_t contains the application-level state in the following order:
    2.21 + *	r0-r31
    2.22 + *	NaT bits (for r0-r31; bit N == 1 iff rN is a NaT)
    2.23 + *	predicate registers (p0-p63)
    2.24 + *	b0-b7
    2.25 + *	ip cfm psr
    2.26 + *	ar.rsc ar.bsp ar.bspstore ar.rnat
    2.27 + *	ar.ccv ar.unat ar.fpsr ar.pfs ar.lc ar.ec ar.csd ar.ssd
    2.28 + */
    2.29 +#define ELF_NGREG	128 /* we really need just 72,
    2.30 +			     * but let's leave some headroom */
    2.31 +
    2.32 +typedef unsigned long elf_greg_t;
    2.33 +typedef elf_greg_t elf_gregset_t[ELF_NGREG];
    2.34 +typedef elf_gregset_t crash_xen_core_t;
    2.35 +
    2.36 +extern void ia64_elf_core_copy_regs (struct pt_regs *src, elf_gregset_t dst);
    2.37  
    2.38  static inline void elf_core_save_regs(ELF_Gregset *core_regs, 
    2.39                                        crash_xen_core_t *xen_core_regs)
    2.40  {
    2.41 -    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
    2.42 +    ia64_elf_core_copy_regs(NULL, *xen_core_regs);
    2.43  }
    2.44  
    2.45  #endif /* __IA64_ELF_H__ */