From a31080021ad3ecfb92220dcb8c717928db268f1e Mon Sep 17 00:00:00 2001 From: Yuanjie Huang Date: Wed, 22 Oct 2014 04:47:57 -0400 Subject: mtd-utils: Fix alignment trap triggered by NEON instructions NEON instruction VLD1.64 was used to copy 64 bits data after type casting, and they will trigger alignment trap. This patch uses memcpy to avoid alignment problem. Signed-off-by: Yuanjie Huang Signed-off-by: Jackie Huang Signed-off-by: Ross Burton --- .../mtd/mtd-utils/fix-armv7-neon-alignment.patch | 44 ++++++++++++++++++++++ meta/recipes-devtools/mtd/mtd-utils_git.bb | 1 + 2 files changed, 45 insertions(+) create mode 100644 meta/recipes-devtools/mtd/mtd-utils/fix-armv7-neon-alignment.patch (limited to 'meta/recipes-devtools/mtd') diff --git a/meta/recipes-devtools/mtd/mtd-utils/fix-armv7-neon-alignment.patch b/meta/recipes-devtools/mtd/mtd-utils/fix-armv7-neon-alignment.patch new file mode 100644 index 0000000000..05f1629d58 --- /dev/null +++ b/meta/recipes-devtools/mtd/mtd-utils/fix-armv7-neon-alignment.patch @@ -0,0 +1,44 @@ +Upstream-Status: Pending + +NEON instruction VLD1.64 was used to copy 64 bits data after type +casting, and they will trigger alignment trap. +This patch uses memcpy to avoid alignment problem. + +Signed-off-by: Yuanjie Huang + +diff --git a/mkfs.ubifs/key.h b/mkfs.ubifs/key.h +index d3a02d4..e7e9218 100644 +--- a/mkfs.ubifs/key.h ++++ b/mkfs.ubifs/key.h +@@ -141,10 +141,12 @@ static inline void data_key_init(union ubifs_key *key, ino_t inum, + */ + static inline void key_write(const union ubifs_key *from, void *to) + { +- union ubifs_key *t = to; ++ __le32 x[2]; + +- t->j32[0] = cpu_to_le32(from->u32[0]); +- t->j32[1] = cpu_to_le32(from->u32[1]); ++ x[0] = cpu_to_le32(from->u32[0]); ++ x[1] = cpu_to_le32(from->u32[1]); ++ ++ memcpy(to, &x, 8); + memset(to + 8, 0, UBIFS_MAX_KEY_LEN - 8); + } + +@@ -156,10 +158,12 @@ static inline void key_write(const union ubifs_key *from, void *to) + */ + static inline void key_write_idx(const union ubifs_key *from, void *to) + { +- union ubifs_key *t = to; ++ __le32 x[2]; ++ ++ x[0] = cpu_to_le32(from->u32[0]); ++ x[1] = cpu_to_le32(from->u32[1]); + +- t->j32[0] = cpu_to_le32(from->u32[0]); +- t->j32[1] = cpu_to_le32(from->u32[1]); ++ memcpy(to, &x, 8); + } + + /** diff --git a/meta/recipes-devtools/mtd/mtd-utils_git.bb b/meta/recipes-devtools/mtd/mtd-utils_git.bb index f78bc7e7f9..52297c63ba 100644 --- a/meta/recipes-devtools/mtd/mtd-utils_git.bb +++ b/meta/recipes-devtools/mtd/mtd-utils_git.bb @@ -10,6 +10,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \ SRCREV = "9f107132a6a073cce37434ca9cda6917dd8d866b" SRC_URI = "git://git.infradead.org/mtd-utils.git \ file://add-exclusion-to-mkfs-jffs2-git-2.patch \ + file://fix-armv7-neon-alignment.patch \ " PV = "1.5.1+git${SRCPV}" -- cgit v1.2.3