WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

[Xen-ia64-devel] [PATCH] IA64: Kdump: 64-bit aligned access to elf-note

To: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-ia64-devel] [PATCH] IA64: Kdump: 64-bit aligned access to elf-note data
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Mon, 22 Oct 2007 11:39:21 +0900
Cc: Alex Williamson <alex.williamson@xxxxxx>
Delivery-date: Sun, 21 Oct 2007 19:40:35 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>