summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhang Yanfei <zhangyanfei@cn.fujitsu.com>2013-03-14 01:34:41 +0800
committerSimon Horman <horms@verge.net.au>2013-03-14 18:24:26 +0900
commit58a22bd5b6d17371493411a7667c8dfcf55d253a (patch)
treeca7526c29316471082b7b8d2f8e001f55b73c291
parent333f48733565f6a3df826b072db9dd6d1c713cb0 (diff)
downloadkexec-tools-58a22bd5b6d17371493411a7667c8dfcf55d253a.tar.gz
kexec: sh: use _ALIGN* to make the logic clear
By replacing all the explicit align opertion with marco _ALIGN*, the code logic could be more clear. Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--kexec/arch/sh/kexec-netbsd-sh.c4
-rw-r--r--kexec/arch/sh/kexec-zImage-sh.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/kexec/arch/sh/kexec-netbsd-sh.c b/kexec/arch/sh/kexec-netbsd-sh.c
index 8e804865..8a7e75ea 100644
--- a/kexec/arch/sh/kexec-netbsd-sh.c
+++ b/kexec/arch/sh/kexec-netbsd-sh.c
@@ -121,7 +121,7 @@ int netbsd_sh_load(int argc, char **argv, const char *buf, off_t UNUSED(len),
size = bbs;
}
- size = (size + psz - 1) & ~(psz - 1);
+ size = _ALIGN(size, psz);
memset(&img[bbs], 0, size-bbs);
add_segment(info, img, size, start, size);
start += size;
@@ -132,7 +132,7 @@ int netbsd_sh_load(int argc, char **argv, const char *buf, off_t UNUSED(len),
if (miniroot) {
miniroot_buf = slurp_file(miniroot, &miniroot_length);
howto_value |= 0x200;
- size = (miniroot_length + psz - 1) & ~(psz - 1);
+ size = _ALIGN(miniroot_length, psz);
add_segment(info, miniroot_buf, size, start, size);
start += size;
}
diff --git a/kexec/arch/sh/kexec-zImage-sh.c b/kexec/arch/sh/kexec-zImage-sh.c
index 1ce185a7..73990529 100644
--- a/kexec/arch/sh/kexec-zImage-sh.c
+++ b/kexec/arch/sh/kexec-zImage-sh.c
@@ -138,7 +138,7 @@ int zImage_sh_load(int argc, char **argv, const char *buf, off_t len,
* the zImage will relocate itself, but only up seems supported.
*/
- image_base = (empty_zero + (0x10000 - 1)) & ~(0x10000 - 1);
+ image_base = _ALIGN(empty_zero, 0x10000);
add_segment(info, buf, len, image_base, len);
info->entry = (void *)virt_to_phys(image_base);
return 0;