diff options
author | Zhang Yanfei <zhangyanfei@cn.fujitsu.com> | 2013-03-14 01:30:27 +0800 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2013-03-14 09:49:10 +0100 |
commit | e8a7f63e0e05617c2edaad7eb618ec6513288b8b (patch) | |
tree | c41eade420424e7c2e2954ea88ec167cc71b4b83 | |
parent | cf190f673b2c5a6cf1aa3a49e764291f1ca75605 (diff) | |
download | kexec-tools-e8a7f63e0e05617c2edaad7eb618ec6513288b8b.tar.gz |
kexec: ia64: use _ALIGN* to make the logic clear
By replacing all the explicit align opertion with marco _ALIGN*,
the code logic could be simplified.
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r-- | kexec/arch/ia64/crashdump-ia64.c | 6 | ||||
-rw-r--r-- | kexec/arch/ia64/kexec-elf-ia64.c | 2 | ||||
-rw-r--r-- | kexec/arch/ia64/kexec-ia64.c | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/kexec/arch/ia64/crashdump-ia64.c b/kexec/arch/ia64/crashdump-ia64.c index 782f49eb..726c9f42 100644 --- a/kexec/arch/ia64/crashdump-ia64.c +++ b/kexec/arch/ia64/crashdump-ia64.c @@ -83,7 +83,7 @@ static void add_loaded_segments_info(struct mem_ehdr *ehdr) } loaded_segments[loaded_segments_num].start = - phdr->p_paddr & ~(ELF_PAGE_SIZE-1); + _ALIGN_DOWN(phdr->p_paddr, ELF_PAGE_SIZE); loaded_segments[loaded_segments_num].end = loaded_segments[loaded_segments_num].start; @@ -97,8 +97,8 @@ static void add_loaded_segments_info(struct mem_ehdr *ehdr) if (phdr->p_type != PT_LOAD) break; loaded_segments[loaded_segments_num].end = - (phdr->p_paddr + phdr->p_memsz + - ELF_PAGE_SIZE - 1) & ~(ELF_PAGE_SIZE - 1); + _ALIGN(phdr->p_paddr + phdr->p_memsz, + ELF_PAGE_SIZE); i++; } loaded_segments_num++; diff --git a/kexec/arch/ia64/kexec-elf-ia64.c b/kexec/arch/ia64/kexec-elf-ia64.c index 8da061e6..7303c03b 100644 --- a/kexec/arch/ia64/kexec-elf-ia64.c +++ b/kexec/arch/ia64/kexec-elf-ia64.c @@ -264,7 +264,7 @@ int elf_ia64_load(int argc, char **argv, const char *buf, off_t len, strcat(cmdline, buf); } - command_line_len = (command_line_len + 15)&(~15); + command_line_len = _ALIGN(command_line_len, 16); command_line_base = add_buffer(info, cmdline, command_line_len, command_line_len, getpagesize(), 0UL, diff --git a/kexec/arch/ia64/kexec-ia64.c b/kexec/arch/ia64/kexec-ia64.c index aa510a9a..418d9974 100644 --- a/kexec/arch/ia64/kexec-ia64.c +++ b/kexec/arch/ia64/kexec-ia64.c @@ -50,8 +50,8 @@ static int split_range(int range, unsigned long start, unsigned long end) unsigned int type = memory_range[range - 1].type; int i; //align end and start to page size of EFI - start = start & ~((1UL<<12) - 1); - end = (end + (1UL<<12) - 1)& ~((1UL<<12) - 1); + start = _ALIGN_DOWN(start, 1UL<<12); + end = _ALIGN(end, 1UL<<12); for (i = 0; i < range; i++) if(memory_range[i].start <= start && memory_range[i].end >=end) break; @@ -230,7 +230,7 @@ int update_loaded_segments(struct mem_ehdr *ehdr) for (i = 0; i < memory_ranges; i++) { if (memory_range[i].type != RANGE_RAM) continue; - start = (memory_range[i].start + align - 1) & ~(align - 1); + start = _ALIGN(memory_range[i].start, align); end = memory_range[i].end; if (end > start && (end - start) > (end_addr - start_addr)) { move_loaded_segments(ehdr, start); |