ia64/xen-unstable
changeset 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>
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 | 98ac6d05aed2 |
children | ecbda3783c85 |
files | xen/include/asm-ia64/elf.h |
line diff
1.1 --- a/xen/include/asm-ia64/elf.h Sun Oct 21 15:58:00 2007 -0600 1.2 +++ b/xen/include/asm-ia64/elf.h Mon Oct 22 12:19:42 2007 -0600 1.3 @@ -31,6 +31,8 @@ typedef struct { 1.4 #define ELF_NGREG 128 /* we really need just 72, 1.5 * but let's leave some headroom */ 1.6 1.7 +#define ALIGN_UP(addr, size) (((addr) + ((size) - 1)) & (~((size) - 1))) 1.8 + 1.9 typedef unsigned long elf_greg_t; 1.10 typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 1.11 typedef elf_gregset_t crash_xen_core_t; 1.12 @@ -40,7 +42,17 @@ extern void ia64_elf_core_copy_regs (str 1.13 static inline void elf_core_save_regs(ELF_Gregset *core_regs, 1.14 crash_xen_core_t *xen_core_regs) 1.15 { 1.16 - ia64_elf_core_copy_regs(NULL, *xen_core_regs); 1.17 + elf_greg_t *aligned_xen_core_regs; 1.18 + 1.19 + /* 1.20 + * Re-align xen_core_regs to 64bit for access to avoid unaligned faults, 1.21 + * then memmove back in place. 1.22 + * xen_core_regs has headroom, so this is ok 1.23 + */ 1.24 + aligned_xen_core_regs = (elf_greg_t *)ALIGN_UP((unsigned long) 1.25 + *xen_core_regs, 8); 1.26 + ia64_elf_core_copy_regs(NULL, aligned_xen_core_regs); 1.27 + memmove(*xen_core_regs, aligned_xen_core_regs, sizeof(crash_xen_core_t)); 1.28 } 1.29 1.30 #endif /* __IA64_ELF_H__ */