ia64/xen-unstable

view xen/include/asm-ia64/elf.h @ 16178:7e69ca25c278

[IA64] Kdump: 64-bit aligned access to elf-note data

xen_core_regs, as passed by kexec_crash_save_info(), is 32-bit aligned as
it is the data section of an ELF-note. In order to ensure 64-bit aligned
access when xen_core_regs is filled in, shift it a bit and then memmove()
the data back into the 32-bit aligned location after the values have been
written.

Without this change kdump panics on an unaligned-access.

Signed-off-by: Simon Horman <horms@verge.net.au>
author Alex Williamson <alex.williamson@hp.com>
date Mon Oct 22 12:19:42 2007 -0600 (2007-10-22)
parents 83239b289072
children
line source
1 #ifndef __IA64_ELF_H__
2 #define __IA64_ELF_H__
4 typedef struct {
5 unsigned long r1;
6 unsigned long r2;
7 unsigned long r13;
8 unsigned long cr_iip;
9 unsigned long ar_rsc;
10 unsigned long r30;
11 unsigned long ar_bspstore;
12 unsigned long ar_rnat;
13 unsigned long ar_ccv;
14 unsigned long ar_unat;
15 unsigned long ar_pfs;
16 unsigned long r31;
17 unsigned long ar_csd;
18 unsigned long ar_ssd;
19 } ELF_Gregset;
21 /*
22 * elf_gregset_t contains the application-level state in the following order:
23 * r0-r31
24 * NaT bits (for r0-r31; bit N == 1 iff rN is a NaT)
25 * predicate registers (p0-p63)
26 * b0-b7
27 * ip cfm psr
28 * ar.rsc ar.bsp ar.bspstore ar.rnat
29 * ar.ccv ar.unat ar.fpsr ar.pfs ar.lc ar.ec ar.csd ar.ssd
30 */
31 #define ELF_NGREG 128 /* we really need just 72,
32 * but let's leave some headroom */
34 #define ALIGN_UP(addr, size) (((addr) + ((size) - 1)) & (~((size) - 1)))
36 typedef unsigned long elf_greg_t;
37 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
38 typedef elf_gregset_t crash_xen_core_t;
40 extern void ia64_elf_core_copy_regs (struct pt_regs *src, elf_gregset_t dst);
42 static inline void elf_core_save_regs(ELF_Gregset *core_regs,
43 crash_xen_core_t *xen_core_regs)
44 {
45 elf_greg_t *aligned_xen_core_regs;
47 /*
48 * Re-align xen_core_regs to 64bit for access to avoid unaligned faults,
49 * then memmove back in place.
50 * xen_core_regs has headroom, so this is ok
51 */
52 aligned_xen_core_regs = (elf_greg_t *)ALIGN_UP((unsigned long)
53 *xen_core_regs, 8);
54 ia64_elf_core_copy_regs(NULL, aligned_xen_core_regs);
55 memmove(*xen_core_regs, aligned_xen_core_regs, sizeof(crash_xen_core_t));
56 }
58 #endif /* __IA64_ELF_H__ */
60 /*
61 * Local variables:
62 * mode: C
63 * c-set-style: "BSD"
64 * c-basic-offset: 4
65 * tab-width: 4
66 * indent-tabs-mode: nil
67 * End:
68 */