diff options
author | Eric Andersen <andersen@codepoet.org> | 2003-12-17 18:34:15 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2003-12-17 18:34:15 +0000 |
commit | 789f5785a650e9cee4c292e33520f2ff9206df17 (patch) | |
tree | 2d49fd5823a0430bcc8a33d4dadd37c04bcd368d | |
parent | 14ad6760690b422e2d0f709c06a543196a6da2c0 (diff) |
Use PAGE_SIZE rather than hard coding 4096
-rw-r--r-- | ldso/include/ldso.h | 2 | ||||
-rw-r--r-- | ldso/ldso/arm/elfinterp.c | 4 | ||||
-rw-r--r-- | ldso/ldso/dl-elf.c | 26 | ||||
-rw-r--r-- | ldso/ldso/ldso.c | 2 | ||||
-rw-r--r-- | ldso/ldso/readelflib1.c | 26 |
5 files changed, 31 insertions, 29 deletions
diff --git a/ldso/include/ldso.h b/ldso/include/ldso.h index b5ccbfaef..a7e885a06 100644 --- a/ldso/include/ldso.h +++ b/ldso/include/ldso.h @@ -9,3 +9,5 @@ #include <ld_syscall.h> #include <ld_hash.h> #include <ld_string.h> +/* Pull in the arch specific page size */ +#include <asm/page.h> diff --git a/ldso/ldso/arm/elfinterp.c b/ldso/ldso/arm/elfinterp.c index 23f2f55f0..6c908a671 100644 --- a/ldso/ldso/arm/elfinterp.c +++ b/ldso/ldso/arm/elfinterp.c @@ -249,7 +249,7 @@ fix_bad_pc24 (unsigned long *const reloc_addr, unsigned long value) unsigned int *fix_address; if (! fix_page) { - fix_page = _dl_mmap (NULL, 4096 , PROT_READ | PROT_WRITE | PROT_EXEC, + fix_page = _dl_mmap (NULL, PAGE_SIZE , PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); fix_offset = 0; } @@ -259,7 +259,7 @@ fix_bad_pc24 (unsigned long *const reloc_addr, unsigned long value) fix_address[1] = value; fix_offset += 8; - if (fix_offset >= 4096) + if (fix_offset >= PAGE_SIZE) fix_page = NULL; return (unsigned long)fix_address; diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 136f7b148..9650b2f53 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -449,7 +449,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, return NULL; } - header = _dl_mmap((void *) 0, 4096, PROT_READ | PROT_WRITE, + header = _dl_mmap((void *) 0, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); if (_dl_mmap_check_error(header)) { _dl_dprintf(2, "%s: can't map '%s'\n", _dl_progname, libname); @@ -458,7 +458,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, return NULL; }; - _dl_read(infile, header, 4096); + _dl_read(infile, header, PAGE_SIZE); epnt = (ElfW(Ehdr) *) (intptr_t) header; if (epnt->e_ident[0] != 0x7f || epnt->e_ident[1] != 'E' || @@ -469,7 +469,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, libname); _dl_internal_error_number = LD_ERROR_NOTELF; _dl_close(infile); - _dl_munmap(header, 4096); + _dl_munmap(header, PAGE_SIZE); return NULL; }; @@ -484,7 +484,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, _dl_dprintf(2, "%s: '%s' is not an ELF executable for " ELF_TARGET "\n", _dl_progname, libname); _dl_close(infile); - _dl_munmap(header, 4096); + _dl_munmap(header, PAGE_SIZE); return NULL; }; @@ -530,7 +530,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, _dl_dprintf(2, "%s: can't map %s\n", _dl_progname, libname); _dl_internal_error_number = LD_ERROR_MMAP_FAILED; _dl_close(infile); - _dl_munmap(header, 4096); + _dl_munmap(header, PAGE_SIZE); return NULL; }; libaddr = (unsigned long) status; @@ -565,7 +565,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, _dl_internal_error_number = LD_ERROR_MMAP_FAILED; _dl_munmap((char *) libaddr, maxvma - minvma); _dl_close(infile); - _dl_munmap(header, 4096); + _dl_munmap(header, PAGE_SIZE); return NULL; }; @@ -598,7 +598,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, _dl_internal_error_number = LD_ERROR_MMAP_FAILED; _dl_munmap((char *) libaddr, maxvma - minvma); _dl_close(infile); - _dl_munmap(header, 4096); + _dl_munmap(header, PAGE_SIZE); return NULL; }; @@ -627,7 +627,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, _dl_internal_error_number = LD_ERROR_NODYNAMIC; _dl_dprintf(2, "%s: '%s' is missing a dynamic section\n", _dl_progname, libname); - _dl_munmap(header, 4096); + _dl_munmap(header, PAGE_SIZE); return NULL; } @@ -730,7 +730,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, } #endif - _dl_munmap(header, 4096); + _dl_munmap(header, PAGE_SIZE); return tpnt; } @@ -784,7 +784,7 @@ void _dl_dprintf(int fd, const char *fmt, ...) char *start, *ptr, *string; static char *buf; - buf = _dl_mmap((void *) 0, 4096, PROT_READ | PROT_WRITE, + buf = _dl_mmap((void *) 0, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); if (_dl_mmap_check_error(buf)) { _dl_write(fd, "mmap of a spare page failed!\n", 29); @@ -796,7 +796,7 @@ void _dl_dprintf(int fd, const char *fmt, ...) if (!fmt) return; - if (_dl_strlen(fmt) >= (4096 - 1)) { + if (_dl_strlen(fmt) >= (PAGE_SIZE - 1)) { _dl_write(fd, "overflow\n", 11); _dl_exit(20); } @@ -854,7 +854,7 @@ void _dl_dprintf(int fd, const char *fmt, ...) start = NULL; } } - _dl_munmap(buf, 4096); + _dl_munmap(buf, PAGE_SIZE); return; } @@ -883,7 +883,7 @@ void *_dl_malloc(int size) if (_dl_malloc_function) return (*_dl_malloc_function) (size); - if (_dl_malloc_addr - _dl_mmap_zero + size > 4096) { + if (_dl_malloc_addr - _dl_mmap_zero + size > PAGE_SIZE) { #ifdef __SUPPORT_LD_DEBUG_EARLY__ _dl_dprintf(2, "malloc: mmapping more memory\n"); #endif diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index 601da6283..768ff241c 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -359,7 +359,7 @@ LD_BOOT(unsigned long args) /* Call mmap to get a page of writable memory that can be used * for _dl_malloc throughout the shared lib loader. */ - mmap_zero = malloc_buffer = _dl_mmap((void *) 0, 4096, + mmap_zero = malloc_buffer = _dl_mmap((void *) 0, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); if (_dl_mmap_check_error(mmap_zero)) { SEND_STDERR("dl_boot: mmap of a spare page failed!\n"); diff --git a/ldso/ldso/readelflib1.c b/ldso/ldso/readelflib1.c index 136f7b148..9650b2f53 100644 --- a/ldso/ldso/readelflib1.c +++ b/ldso/ldso/readelflib1.c @@ -449,7 +449,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, return NULL; } - header = _dl_mmap((void *) 0, 4096, PROT_READ | PROT_WRITE, + header = _dl_mmap((void *) 0, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); if (_dl_mmap_check_error(header)) { _dl_dprintf(2, "%s: can't map '%s'\n", _dl_progname, libname); @@ -458,7 +458,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, return NULL; }; - _dl_read(infile, header, 4096); + _dl_read(infile, header, PAGE_SIZE); epnt = (ElfW(Ehdr) *) (intptr_t) header; if (epnt->e_ident[0] != 0x7f || epnt->e_ident[1] != 'E' || @@ -469,7 +469,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, libname); _dl_internal_error_number = LD_ERROR_NOTELF; _dl_close(infile); - _dl_munmap(header, 4096); + _dl_munmap(header, PAGE_SIZE); return NULL; }; @@ -484,7 +484,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, _dl_dprintf(2, "%s: '%s' is not an ELF executable for " ELF_TARGET "\n", _dl_progname, libname); _dl_close(infile); - _dl_munmap(header, 4096); + _dl_munmap(header, PAGE_SIZE); return NULL; }; @@ -530,7 +530,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, _dl_dprintf(2, "%s: can't map %s\n", _dl_progname, libname); _dl_internal_error_number = LD_ERROR_MMAP_FAILED; _dl_close(infile); - _dl_munmap(header, 4096); + _dl_munmap(header, PAGE_SIZE); return NULL; }; libaddr = (unsigned long) status; @@ -565,7 +565,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, _dl_internal_error_number = LD_ERROR_MMAP_FAILED; _dl_munmap((char *) libaddr, maxvma - minvma); _dl_close(infile); - _dl_munmap(header, 4096); + _dl_munmap(header, PAGE_SIZE); return NULL; }; @@ -598,7 +598,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, _dl_internal_error_number = LD_ERROR_MMAP_FAILED; _dl_munmap((char *) libaddr, maxvma - minvma); _dl_close(infile); - _dl_munmap(header, 4096); + _dl_munmap(header, PAGE_SIZE); return NULL; }; @@ -627,7 +627,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, _dl_internal_error_number = LD_ERROR_NODYNAMIC; _dl_dprintf(2, "%s: '%s' is missing a dynamic section\n", _dl_progname, libname); - _dl_munmap(header, 4096); + _dl_munmap(header, PAGE_SIZE); return NULL; } @@ -730,7 +730,7 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, } #endif - _dl_munmap(header, 4096); + _dl_munmap(header, PAGE_SIZE); return tpnt; } @@ -784,7 +784,7 @@ void _dl_dprintf(int fd, const char *fmt, ...) char *start, *ptr, *string; static char *buf; - buf = _dl_mmap((void *) 0, 4096, PROT_READ | PROT_WRITE, + buf = _dl_mmap((void *) 0, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); if (_dl_mmap_check_error(buf)) { _dl_write(fd, "mmap of a spare page failed!\n", 29); @@ -796,7 +796,7 @@ void _dl_dprintf(int fd, const char *fmt, ...) if (!fmt) return; - if (_dl_strlen(fmt) >= (4096 - 1)) { + if (_dl_strlen(fmt) >= (PAGE_SIZE - 1)) { _dl_write(fd, "overflow\n", 11); _dl_exit(20); } @@ -854,7 +854,7 @@ void _dl_dprintf(int fd, const char *fmt, ...) start = NULL; } } - _dl_munmap(buf, 4096); + _dl_munmap(buf, PAGE_SIZE); return; } @@ -883,7 +883,7 @@ void *_dl_malloc(int size) if (_dl_malloc_function) return (*_dl_malloc_function) (size); - if (_dl_malloc_addr - _dl_mmap_zero + size > 4096) { + if (_dl_malloc_addr - _dl_mmap_zero + size > PAGE_SIZE) { #ifdef __SUPPORT_LD_DEBUG_EARLY__ _dl_dprintf(2, "malloc: mmapping more memory\n"); #endif |