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@xxxxxxxxxxxx>
Index: xen-unstable.hg/xen/include/asm-ia64/elf.h
===================================================================
--- xen-unstable.hg.orig/xen/include/asm-ia64/elf.h 2007-10-22
11:22:19.000000000 +0900
+++ xen-unstable.hg/xen/include/asm-ia64/elf.h 2007-10-22 11:32:12.000000000
+0900
@@ -31,6 +31,8 @@ typedef struct {
#define ELF_NGREG 128 /* we really need just 72,
* but let's leave some headroom */
+#define ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1)))
+
typedef unsigned long elf_greg_t;
typedef elf_greg_t elf_gregset_t[ELF_NGREG];
typedef elf_gregset_t crash_xen_core_t;
@@ -40,7 +42,12 @@ extern void ia64_elf_core_copy_regs (str
static inline void elf_core_save_regs(ELF_Gregset *core_regs,
crash_xen_core_t *xen_core_regs)
{
- ia64_elf_core_copy_regs(NULL, *xen_core_regs);
+ elf_greg_t *aligned_xen_core_regs;
+ /* xen_core_regs has headroom, so this is ok */
+ aligned_xen_core_regs = (elf_greg_t *)ALIGN_UP((unsigned long)
+ *xen_core_regs, 8);
+ ia64_elf_core_copy_regs(NULL, aligned_xen_core_regs);
+ memmove(*xen_core_regs, aligned_xen_core_regs, sizeof(crash_xen_core_t));
}
#endif /* __IA64_ELF_H__ */
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel
|