summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2008-07-05 22:59:15 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2008-07-05 22:59:15 +0000
commitb0c090ec0984d6b1432e9d7e44df77a6048c73b0 (patch)
tree5a927e4495e1717e994e7a87a138a8f697d4dc94 /sys/arch/sparc64
parent648302818ea2ffbe83977b9a962b25274334668e (diff)
Round up memory allocations to page size. Apparently sane firmware versions do
this automatically, but the braindead firmware on the v1280 doesn't do this and makes the allocation fail.
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/stand/ofwboot/elfXX_exec.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/arch/sparc64/stand/ofwboot/elfXX_exec.c b/sys/arch/sparc64/stand/ofwboot/elfXX_exec.c
index b262d45c00c..a45d94b89f6 100644
--- a/sys/arch/sparc64/stand/ofwboot/elfXX_exec.c
+++ b/sys/arch/sparc64/stand/ofwboot/elfXX_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: elfXX_exec.c,v 1.6 2007/01/12 20:16:19 miod Exp $ */
+/* $OpenBSD: elfXX_exec.c,v 1.7 2008/07/05 22:59:14 kettenis Exp $ */
/* $NetBSD: elfXX_exec.c,v 1.2 2001/08/15 20:08:15 eeh Exp $ */
/*
@@ -102,7 +102,8 @@ CAT3(elf, ELFSIZE, _exec)(fd, elf, entryp, ssymp, esymp)
if ((phdr.p_vaddr & (4*MEG-1)) == 0)
align = 4*MEG;
if (phdr.p_filesz < phdr.p_memsz)
- phdr.p_memsz = (phdr.p_memsz + 4*MEG) & ~(4*MEG-1);
+ phdr.p_memsz = roundup(phdr.p_memsz, 4*MEG);
+ phdr.p_memsz = roundup(phdr.p_memsz, NBPG);
if (OF_claim((void *)(long)phdr.p_vaddr, phdr.p_memsz, align) ==
(void *)-1)
panic("cannot claim memory");
@@ -151,7 +152,7 @@ CAT3(elf, ELFSIZE, _exec)(fd, elf, entryp, ssymp, esymp)
/*
* Reserve memory for the symbols.
*/
- if ((addr = OF_claim(0, size, NBPG)) == (void *)-1)
+ if ((addr = OF_claim(0, roundup(size, NBPG), NBPG)) == (void *)-1)
panic("no space for symbol table");
/*