summaryrefslogtreecommitdiff
path: root/kexec/arch/sh/kexec-netbsd-sh.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2008-02-04 13:35:31 +0900
committerSimon Horman <horms@verge.net.au>2008-02-19 15:06:57 +0900
commitb5ee3392dc71c53f93716cb387abacb544d9cf9c (patch)
tree4801f437b4ed6bca899c0e9469fb1b9f7a2e87c7 /kexec/arch/sh/kexec-netbsd-sh.c
parentab2df5cd479da9935e23cd7042d69a39f5cec3b0 (diff)
sh: Remove hardcoded PAGE_SIZE in NetBSD loader
The Linux host supports a multitude of page sizes, so having this hardcoded doesn't really help matters. This also has the benefit of killing off dependence on asm/ headers when none is needed. While I'm not suggesting that anyone actually boot NetBSD, without this, my build also ends up breaking. Signed-off-by: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/arch/sh/kexec-netbsd-sh.c')
-rw-r--r--kexec/arch/sh/kexec-netbsd-sh.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/kexec/arch/sh/kexec-netbsd-sh.c b/kexec/arch/sh/kexec-netbsd-sh.c
index a751420..07c7f26 100644
--- a/kexec/arch/sh/kexec-netbsd-sh.c
+++ b/kexec/arch/sh/kexec-netbsd-sh.c
@@ -25,13 +25,10 @@
#include "../../kexec.h"
#include "../../kexec-elf.h"
#include <arch/options.h>
-#include <asm/page.h>
static const int probe_debug = 0;
const extern unsigned char netbsd_booter[];
-#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
/*
* netbsd_sh_probe - sanity check the elf image
*
@@ -62,7 +59,7 @@ int netbsd_sh_load(int argc, char **argv, const char *buf, off_t len,
struct kexec_info *info)
{
const char *howto, *miniroot;
- unsigned long entry, start, size;
+ unsigned long entry, start, size, psz;
char *miniroot_buf;
off_t miniroot_length;
unsigned int howto_value;
@@ -105,6 +102,8 @@ int netbsd_sh_load(int argc, char **argv, const char *buf, off_t len,
howto_value = strtol(howto, NULL, 0);
}
+ psz = getpagesize();
+
/* Parse the Elf file */
{
Elf32_Ehdr *ehdr;
@@ -122,7 +121,8 @@ int netbsd_sh_load(int argc, char **argv, const char *buf, off_t len,
if(size < bbs){
size = bbs;
}
- size = PAGE_ALIGN(size);
+
+ size = (size + psz - 1) & ~(psz - 1);
memset(&img[bbs], 0, size-bbs);
add_segment(info, img, size, start, size);
start += size;
@@ -133,7 +133,7 @@ int netbsd_sh_load(int argc, char **argv, const char *buf, off_t len,
if (miniroot) {
miniroot_buf = slurp_file(miniroot, &miniroot_length);
howto_value |= 0x200;
- size = PAGE_ALIGN(miniroot_length);
+ size = (miniroot_length + psz - 1) & ~(psz - 1);
add_segment(info, miniroot_buf, size, start, size);
start += size;
}