From 010301e968b4aa9a37dfd437f89c054016b2de0f Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 18 Feb 2006 07:03:24 +0000 Subject: tweak the idea between having a MMU and actually using it --- Makefile.in | 2 +- extra/Configs/Config.in.arch | 10 ++++++++++ include/sys/mman.h | 2 +- include/unistd.h | 4 ++-- libc/inet/rpc/rcmd.c | 22 +++++++++++----------- libc/misc/internals/__uClibc_main.c | 10 +++++----- libc/stdlib/malloc-simple/alloc.c | 2 +- libc/stdlib/malloc-standard/malloc.h | 2 +- libc/stdlib/malloc/malloc.c | 2 +- libc/stdlib/malloc/malloc.h | 2 +- libc/sysdeps/linux/arm/crt1.S | 2 +- libc/sysdeps/linux/common/bits/posix_opt.h | 6 +++--- libc/sysdeps/linux/common/fork.c | 2 +- libc/sysdeps/linux/common/ioperm.c | 2 +- libc/sysdeps/linux/common/iopl.c | 2 +- libc/sysdeps/linux/common/mlock.c | 2 +- libc/sysdeps/linux/common/mlockall.c | 2 +- libc/sysdeps/linux/common/munlock.c | 2 +- libc/sysdeps/linux/common/munlockall.c | 2 +- libc/unistd/Makefile.in | 2 +- libc/unistd/exec.c | 2 +- libpthread/linuxthreads.old/internals.h | 10 +++++----- libpthread/linuxthreads.old/manager.c | 14 +++++++------- libpthread/linuxthreads.old/ptfork.c | 2 +- libpthread/linuxthreads.old/pthread.c | 10 +++++----- libpthread/linuxthreads/manager.c | 2 +- libutil/Makefile.in | 2 +- test/test-skeleton.c | 2 +- test/unistd/fork.c | 2 +- 29 files changed, 69 insertions(+), 59 deletions(-) diff --git a/Makefile.in b/Makefile.in index 33424af65..54a93cd85 100644 --- a/Makefile.in +++ b/Makefile.in @@ -45,7 +45,7 @@ include/bits/uClibc_config.h: extra/config/conf .config # in order to generate the headers correctly :(. That # means we can't use the $(HOSTCC) in order to get the # correct output. -ifeq ($(ARCH_HAS_MMU),y) +ifeq ($(ARCH_USE_MMU),y) export header_extra_args = else export header_extra_args = -n diff --git a/extra/Configs/Config.in.arch b/extra/Configs/Config.in.arch index 200fdabd3..a8fc45d27 100644 --- a/extra/Configs/Config.in.arch +++ b/extra/Configs/Config.in.arch @@ -48,6 +48,16 @@ config ARCH_HAS_MMU Most people will answer Y. +config ARCH_USE_MMU + bool "Do you want to utilize the MMU?" + depends on ARCH_HAS_MMU + default y + help + If your target CPU has a MMU, and you wish to actually utilize it, + then answer Y here. Normal Linux requires an MMU. + + If you're unsure, answer Y. + config UCLIBC_HAS_FLOATS bool "Enable floating point number support" default y diff --git a/include/sys/mman.h b/include/sys/mman.h index 587dff60d..6ad3b9d75 100644 --- a/include/sys/mman.h +++ b/include/sys/mman.h @@ -99,7 +99,7 @@ extern int madvise (void *__addr, size_t __len, int __advice) __THROW; extern int posix_madvise (void *__addr, size_t __len, int __advice) __THROW; #endif -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ /* Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to be memory resident. */ extern int mlock (__const void *__addr, size_t __len) __THROW; diff --git a/include/unistd.h b/include/unistd.h index 9ccb0e80f..ed09a9047 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -703,7 +703,7 @@ extern int setresgid (__gid_t __egid, __gid_t __rgid, __gid_t __sgid) #endif -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ /* Clone the calling process, creating an exact copy. Return -1 for errors, 0 to the new process, and the process ID of the new process to the old process. */ @@ -885,7 +885,7 @@ extern void endusershell (void) __THROW; /* Discard cached info. */ extern void setusershell (void) __THROW; /* Rewind and re-read the file. */ -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ /* Put the program in the background, and dissociate from the controlling terminal. If NOCHDIR is zero, do `chdir ("/")'. If NOCLOSE is zero, redirects stdin, stdout, and stderr to /dev/null. */ diff --git a/libc/inet/rpc/rcmd.c b/libc/inet/rpc/rcmd.c index 472212f54..b4fe8cfe7 100644 --- a/libc/inet/rpc/rcmd.c +++ b/libc/inet/rpc/rcmd.c @@ -174,7 +174,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) #ifdef __UCLIBC_HAS_REENTRANT_RPC__ hstbuflen = 1024; -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ tmphstbuf = alloca (hstbuflen); #else tmphstbuf = malloc (hstbuflen); @@ -186,7 +186,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) if (herr != NETDB_INTERNAL || errno != ERANGE) { __set_h_errno (herr); -#ifndef __ARCH_HAS_MMU__ +#ifndef __ARCH_USE_MMU__ free(tmphstbuf); #endif herror(*ahost); @@ -196,7 +196,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) { /* Enlarge the buffer. */ hstbuflen *= 2; -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ tmphstbuf = alloca (hstbuflen); #else if (tmphstbuf) { @@ -206,7 +206,7 @@ int rcmd(ahost, rport, locuser, remuser, cmd, fd2p) #endif } } -#ifndef __ARCH_HAS_MMU__ +#ifndef __ARCH_USE_MMU__ free(tmphstbuf); #endif #else /* call the non-reentrant version */ @@ -388,7 +388,7 @@ int ruserok(rhost, superuser, ruser, luser) #ifdef __UCLIBC_HAS_REENTRANT_RPC__ buflen = 1024; -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ buffer = alloca (buflen); #else buffer = malloc (buflen); @@ -398,7 +398,7 @@ int ruserok(rhost, superuser, ruser, luser) buflen, &hp, &herr) != 0 || hp == NULL) { if (herr != NETDB_INTERNAL || errno != ERANGE) { -#ifndef __ARCH_HAS_MMU__ +#ifndef __ARCH_USE_MMU__ free(buffer); #endif return -1; @@ -406,7 +406,7 @@ int ruserok(rhost, superuser, ruser, luser) { /* Enlarge the buffer. */ buflen *= 2; -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ buffer = alloca (buflen); #else if (buffer) { @@ -416,7 +416,7 @@ int ruserok(rhost, superuser, ruser, luser) #endif } } -#ifndef __ARCH_HAS_MMU__ +#ifndef __ARCH_USE_MMU__ free(buffer); #endif #else @@ -513,7 +513,7 @@ iruserok2 (raddr, superuser, ruser, luser, rhost) #ifdef __UCLIBC_HAS_REENTRANT_RPC__ size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX); struct passwd pwdbuf; -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ char *buffer = alloca (buflen); #else char *buffer = malloc (buflen); @@ -522,12 +522,12 @@ iruserok2 (raddr, superuser, ruser, luser, rhost) if (getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) != 0 || pwd == NULL) { -#ifndef __ARCH_HAS_MMU__ +#ifndef __ARCH_USE_MMU__ free(buffer); #endif return -1; } -#ifndef __ARCH_HAS_MMU__ +#ifndef __ARCH_USE_MMU__ free(buffer); #endif #else diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c index 687585860..c50244494 100644 --- a/libc/misc/internals/__uClibc_main.c +++ b/libc/misc/internals/__uClibc_main.c @@ -33,7 +33,7 @@ libc_hidden_proto(exit) #ifdef __UCLIBC_HAS_PROGRAM_INVOCATION_NAME__ libc_hidden_proto(strrchr) #endif -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ libc_hidden_proto(memcpy) libc_hidden_proto(getgid) libc_hidden_proto(getuid) @@ -131,7 +131,7 @@ libc_hidden_data_def(__pagesize) # define O_NOFOLLOW 0 #endif -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ static void __check_one_fd(int fd, int mode) { /* Check if the specified fd is already open */ @@ -272,7 +272,7 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, char **argv, void (*app_init)(void), void (*app_fini)(void), void (*rtld_fini)(void), void *stack_end) { -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ unsigned long *aux_dat; ElfW(auxv_t) auxvt[AT_EGID + 1]; #endif @@ -293,7 +293,7 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, __environ = &argv[argc]; } -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ /* Pull stuff from the ELF header when possible */ aux_dat = (unsigned long*)__environ; while (*aux_dat) { @@ -314,7 +314,7 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, * __uClibc_init() regardless, to be sure the right thing happens. */ __uClibc_init(); -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ /* Make certain getpagesize() gives the correct answer */ __pagesize = (auxvt[AT_PAGESZ].a_un.a_val)? auxvt[AT_PAGESZ].a_un.a_val : PAGE_SIZE; diff --git a/libc/stdlib/malloc-simple/alloc.c b/libc/stdlib/malloc-simple/alloc.c index 65d4bb277..e382cee55 100644 --- a/libc/stdlib/malloc-simple/alloc.c +++ b/libc/stdlib/malloc-simple/alloc.c @@ -36,7 +36,7 @@ void *malloc(size_t size) #endif } -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ # define MMAP_FLAGS MAP_PRIVATE | MAP_ANONYMOUS #else # define MMAP_FLAGS MAP_SHARED | MAP_ANONYMOUS diff --git a/libc/stdlib/malloc-standard/malloc.h b/libc/stdlib/malloc-standard/malloc.h index 628b47dc3..a3fabb0c4 100644 --- a/libc/stdlib/malloc-standard/malloc.h +++ b/libc/stdlib/malloc-standard/malloc.h @@ -354,7 +354,7 @@ libc_hidden_proto(__malloc_lock) #define MAP_ANONYMOUS MAP_ANON #endif -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ #define MMAP(addr, size, prot) \ (mmap((addr), (size), (prot), MAP_PRIVATE|MAP_ANONYMOUS, 0, 0)) diff --git a/libc/stdlib/malloc/malloc.c b/libc/stdlib/malloc/malloc.c index 329788aec..2ec8b07da 100644 --- a/libc/stdlib/malloc/malloc.c +++ b/libc/stdlib/malloc/malloc.c @@ -106,7 +106,7 @@ malloc_from_heap (size_t size, struct heap *heap) #else /* !MALLOC_USE_SBRK */ /* Otherwise, use mmap. */ -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ block = mmap ((void *)0, block_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); #else diff --git a/libc/stdlib/malloc/malloc.h b/libc/stdlib/malloc/malloc.h index 9360eecda..753205443 100644 --- a/libc/stdlib/malloc/malloc.h +++ b/libc/stdlib/malloc/malloc.h @@ -44,7 +44,7 @@ libc_hidden_proto(__pagesize) heap, instead of mmap/munmap. This is a tradeoff -- sbrk is faster than mmap/munmap, and guarantees contiguous allocation, but is also less flexible, and causes the heap to only be shrinkable from the end. */ -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ # define MALLOC_USE_SBRK #endif diff --git a/libc/sysdeps/linux/arm/crt1.S b/libc/sysdeps/linux/arm/crt1.S index 8e0faab47..02c2f8de9 100644 --- a/libc/sysdeps/linux/arm/crt1.S +++ b/libc/sysdeps/linux/arm/crt1.S @@ -110,7 +110,7 @@ _start: mov fp, #0 mov lr, #0 -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ /* Pop argc off the stack and save a pointer to argv */ ldr a2, [sp], #4 mov a3, sp diff --git a/libc/sysdeps/linux/common/bits/posix_opt.h b/libc/sysdeps/linux/common/bits/posix_opt.h index 330989128..b2cae9d41 100644 --- a/libc/sysdeps/linux/common/bits/posix_opt.h +++ b/libc/sysdeps/linux/common/bits/posix_opt.h @@ -43,21 +43,21 @@ #define _POSIX_MAPPED_FILES 200112L /* Locking of all memory is supported. */ -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ # define _POSIX_MEMLOCK 200112L #else # undef _POSIX_MEMLOCK #endif /* Locking of ranges of memory is supported. */ -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ # define _POSIX_MEMLOCK_RANGE 200112L #else # define _POSIX_MEMLOCK_RANGE #endif /* Setting of memory protections is supported. */ -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ # define _POSIX_MEMORY_PROTECTION 1 #else # undef _POSIX_MEMORY_PROTECTION diff --git a/libc/sysdeps/linux/common/fork.c b/libc/sysdeps/linux/common/fork.c index 7c94843ec..884e986ab 100644 --- a/libc/sysdeps/linux/common/fork.c +++ b/libc/sysdeps/linux/common/fork.c @@ -10,7 +10,7 @@ #include "syscalls.h" #include -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ #ifdef __NR_fork extern __typeof(fork) __libc_fork; #define __NR___libc_fork __NR_fork diff --git a/libc/sysdeps/linux/common/ioperm.c b/libc/sysdeps/linux/common/ioperm.c index fc57a97e1..e9ca964cc 100644 --- a/libc/sysdeps/linux/common/ioperm.c +++ b/libc/sysdeps/linux/common/ioperm.c @@ -8,7 +8,7 @@ */ #include "syscalls.h" -#if defined __ARCH_HAS_MMU__ && defined __NR_ioperm +#if defined __ARCH_USE_MMU__ && defined __NR_ioperm /* psm: can't #include , some archs miss it */ extern int ioperm(unsigned long __from, unsigned long __num, int __turn_on) __THROW; _syscall3(int, ioperm, unsigned long, from, unsigned long, num, int, turn_on); diff --git a/libc/sysdeps/linux/common/iopl.c b/libc/sysdeps/linux/common/iopl.c index 90069c08e..2a6b619d5 100644 --- a/libc/sysdeps/linux/common/iopl.c +++ b/libc/sysdeps/linux/common/iopl.c @@ -8,7 +8,7 @@ */ #include "syscalls.h" -#if defined __ARCH_HAS_MMU__ && defined __NR_iopl +#if defined __ARCH_USE_MMU__ && defined __NR_iopl /* psm: can't #include , some archs miss it */ extern int iopl(int __level) __THROW; _syscall1(int, iopl, int, level); diff --git a/libc/sysdeps/linux/common/mlock.c b/libc/sysdeps/linux/common/mlock.c index 28a6e7927..3eb72bb07 100644 --- a/libc/sysdeps/linux/common/mlock.c +++ b/libc/sysdeps/linux/common/mlock.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include -#if defined __ARCH_HAS_MMU__ && defined __NR_mlock +#if defined __ARCH_USE_MMU__ && defined __NR_mlock _syscall2(int, mlock, const void *, addr, size_t, len); #endif diff --git a/libc/sysdeps/linux/common/mlockall.c b/libc/sysdeps/linux/common/mlockall.c index ea48811ae..6e6d3bc36 100644 --- a/libc/sysdeps/linux/common/mlockall.c +++ b/libc/sysdeps/linux/common/mlockall.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include -#if defined __ARCH_HAS_MMU__ && defined __NR_mlockall +#if defined __ARCH_USE_MMU__ && defined __NR_mlockall _syscall1(int, mlockall, int, flags); #endif diff --git a/libc/sysdeps/linux/common/munlock.c b/libc/sysdeps/linux/common/munlock.c index 80fd898fa..1d6870ecc 100644 --- a/libc/sysdeps/linux/common/munlock.c +++ b/libc/sysdeps/linux/common/munlock.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include -#if defined __ARCH_HAS_MMU__ && defined __NR_munlock +#if defined __ARCH_USE_MMU__ && defined __NR_munlock _syscall2(int, munlock, const void *, addr, size_t, len); #endif diff --git a/libc/sysdeps/linux/common/munlockall.c b/libc/sysdeps/linux/common/munlockall.c index d0a086a37..4ee729292 100644 --- a/libc/sysdeps/linux/common/munlockall.c +++ b/libc/sysdeps/linux/common/munlockall.c @@ -9,6 +9,6 @@ #include "syscalls.h" #include -#if defined __ARCH_HAS_MMU__ +#if defined __ARCH_USE_MMU__ _syscall0(int, munlockall); #endif diff --git a/libc/unistd/Makefile.in b/libc/unistd/Makefile.in index 198a4eab2..4a0bb0734 100644 --- a/libc/unistd/Makefile.in +++ b/libc/unistd/Makefile.in @@ -12,7 +12,7 @@ CSRC := $(notdir $(wildcard $(UNISTD_DIR)/*.c)) # multi source CSRC := $(filter-out exec.c,$(CSRC)) -ifeq ($(ARCH_HAS_MMU),y) +ifeq ($(ARCH_USE_MMU),y) CSRC := $(filter-out __exec_alloc.c,$(CSRC)) else CSRC := $(filter-out daemon.c,$(CSRC)) diff --git a/libc/unistd/exec.c b/libc/unistd/exec.c index 1e574825a..3563723ad 100644 --- a/libc/unistd/exec.c +++ b/libc/unistd/exec.c @@ -53,7 +53,7 @@ libc_hidden_proto(getenv) libc_hidden_proto(__environ) /**********************************************************************/ -#if defined(__ARCH_HAS_MMU__) || defined(__UCLIBC_UCLINUX_BROKEN_MUNMAP__) +#if defined(__ARCH_USE_MMU__) || defined(__UCLIBC_UCLINUX_BROKEN_MUNMAP__) /* We have an MMU, so use alloca() to grab space for buffers and * arg lists. Also fall back to alloca() if munmap() is broken. */ diff --git a/libpthread/linuxthreads.old/internals.h b/libpthread/linuxthreads.old/internals.h index 1c4856bc9..17b724e64 100644 --- a/libpthread/linuxthreads.old/internals.h +++ b/libpthread/linuxthreads.old/internals.h @@ -258,7 +258,7 @@ extern pthread_descr __pthread_main_thread; * the bounds a-priori. -StS */ extern char *__pthread_initial_thread_bos; -#ifndef __ARCH_HAS_MMU__ +#ifndef __ARCH_USE_MMU__ extern char *__pthread_initial_thread_tos; #define NOMMU_INITIAL_THREAD_BOUNDS(tos,bos) \ if ((tos)>=__pthread_initial_thread_bos \ @@ -266,7 +266,7 @@ extern char *__pthread_initial_thread_tos; __pthread_initial_thread_bos = (tos)+1 #else #define NOMMU_INITIAL_THREAD_BOUNDS(tos,bos) /* empty */ -#endif /* __ARCH_HAS_MMU__ */ +#endif /* __ARCH_USE_MMU__ */ /* Indicate whether at least one thread has a user-defined stack (if 1), @@ -330,7 +330,7 @@ extern size_t __pagesize; THREAD_SELF implementation is used, this must be a power of two and a multiple of PAGE_SIZE. */ #ifndef STACK_SIZE -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ #define STACK_SIZE (2 * 1024 * 1024) #else #define STACK_SIZE (4 * __pagesize) @@ -387,7 +387,7 @@ static inline pthread_descr thread_self (void) return THREAD_SELF; #else char *sp = CURRENT_STACK_FRAME; -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ if (sp >= __pthread_initial_thread_bos) return &__pthread_initial_thread; else if (sp >= __pthread_manager_thread_bos @@ -420,7 +420,7 @@ static inline pthread_descr thread_self (void) else { return __pthread_find_self(); } -#endif /* __ARCH_HAS_MMU__ */ +#endif /* __ARCH_USE_MMU__ */ #endif } diff --git a/libpthread/linuxthreads.old/manager.c b/libpthread/linuxthreads.old/manager.c index 637a578d5..df26344e7 100644 --- a/libpthread/linuxthreads.old/manager.c +++ b/libpthread/linuxthreads.old/manager.c @@ -360,7 +360,7 @@ static int pthread_allocate_stack(const pthread_attr_t *attr, } else { -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ stacksize = STACK_SIZE - pagesize; if (attr != NULL) stacksize = MIN (stacksize, roundup(attr->__stacksize, pagesize)); @@ -450,7 +450,7 @@ static int pthread_allocate_stack(const pthread_attr_t *attr, /* on non-MMU systems we always have non-standard stack frames */ __pthread_nonstandard_stacks = 1; -#endif /* __ARCH_HAS_MMU__ */ +#endif /* __ARCH_USE_MMU__ */ } /* Clear the thread data structure. */ @@ -495,7 +495,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, &new_thread, &new_thread_bottom, &guardaddr, &guardsize) == 0) break; -#ifndef __ARCH_HAS_MMU__ +#ifndef __ARCH_USE_MMU__ else /* When there is MMU, mmap () is used to allocate the stack. If one * segment is already mapped, we should continue to see if we can @@ -632,14 +632,14 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, /* Free the stack if we allocated it */ if (attr == NULL || !attr->__stackaddr_set) { -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ if (new_thread->p_guardsize != 0) munmap(new_thread->p_guardaddr, new_thread->p_guardsize); munmap((caddr_t)((char *)(new_thread+1) - INITIAL_STACK_SIZE), INITIAL_STACK_SIZE); #else free(new_thread_bottom); -#endif /* __ARCH_HAS_MMU__ */ +#endif /* __ARCH_USE_MMU__ */ } __pthread_handles[sseg].h_descr = NULL; __pthread_handles[sseg].h_bottom = NULL; @@ -716,7 +716,7 @@ static void pthread_free(pthread_descr th) /* If initial thread, nothing to free */ if (th == &__pthread_initial_thread) return; -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ if (!th->p_userstack) { /* Free the stack and thread descriptor area */ @@ -729,7 +729,7 @@ static void pthread_free(pthread_descr th) if (!th->p_userstack) { free(h_bottom_save); } -#endif /* __ARCH_HAS_MMU__ */ +#endif /* __ARCH_USE_MMU__ */ } /* Handle threads that have exited */ diff --git a/libpthread/linuxthreads.old/ptfork.c b/libpthread/linuxthreads.old/ptfork.c index 2ecab8884..184508a3d 100644 --- a/libpthread/linuxthreads.old/ptfork.c +++ b/libpthread/linuxthreads.old/ptfork.c @@ -18,7 +18,7 @@ #include -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ #include #include diff --git a/libpthread/linuxthreads.old/pthread.c b/libpthread/linuxthreads.old/pthread.c index f66073efc..4adf66cd6 100644 --- a/libpthread/linuxthreads.old/pthread.c +++ b/libpthread/linuxthreads.old/pthread.c @@ -172,9 +172,9 @@ char *__pthread_initial_thread_bos = NULL; * This is adapted when other stacks are malloc'ed since we don't know * the bounds a-priori. -StS */ -#ifndef __ARCH_HAS_MMU__ +#ifndef __ARCH_USE_MMU__ char *__pthread_initial_thread_tos = NULL; -#endif /* __ARCH_HAS_MMU__ */ +#endif /* __ARCH_USE_MMU__ */ /* File descriptor for sending requests to the thread manager. */ /* Initially -1, meaning that the thread manager is not running. */ @@ -363,7 +363,7 @@ static void pthread_initialize(void) { struct sigaction sa; sigset_t mask; -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ struct rlimit limit; rlim_t max_stack; #endif @@ -410,7 +410,7 @@ static void pthread_initialize(void) beyond STACK_SIZE minus two pages (one page for the thread descriptor immediately beyond, and one page to act as a guard page). */ -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ /* We cannot allocate a huge chunk of memory to mmap all thread stacks later * on a non-MMU system. Thus, we don't need the rlimit either. -StS */ getrlimit(RLIMIT_STACK, &limit); @@ -429,7 +429,7 @@ static void pthread_initialize(void) __pthread_initial_thread_bos = (char *) 1; /* set it non-zero so we know we have been here */ PDEBUG("initial thread stack bounds: bos=%p, tos=%p\n", __pthread_initial_thread_bos, __pthread_initial_thread_tos); -#endif /* __ARCH_HAS_MMU__ */ +#endif /* __ARCH_USE_MMU__ */ /* Setup signal handlers for the initial thread. Since signal handlers are shared between threads, these settings diff --git a/libpthread/linuxthreads/manager.c b/libpthread/linuxthreads/manager.c index 4cd575b41..42912edb7 100644 --- a/libpthread/linuxthreads/manager.c +++ b/libpthread/linuxthreads/manager.c @@ -648,7 +648,7 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr, new_thread = (pthread_descr) stack_addr; #endif break; -#ifndef __ARCH_HAS_MMU__ +#ifndef __ARCH_USE_MMU__ } else { /* When there is MMU, mmap () is used to allocate the stack. If one * segment is already mapped, we should continue to see if we can diff --git a/libutil/Makefile.in b/libutil/Makefile.in index 20d103184..b42763d21 100644 --- a/libutil/Makefile.in +++ b/libutil/Makefile.in @@ -17,7 +17,7 @@ libutil_DIR := $(top_srcdir)libutil libutil_OUT := $(top_builddir)libutil libutil_SRC := $(wildcard $(libutil_DIR)/*.c) -ifneq ($(ARCH_HAS_MMU),y) +ifneq ($(ARCH_USE_MMU),y) libutil_SRC := $(filter-out $(libutil_DIR)/forkpty.c,$(libutil_SRC)) endif libutil_OBJ := $(patsubst $(libutil_DIR)/%.c,$(libutil_OUT)/%.o,$(libutil_SRC)) diff --git a/test/test-skeleton.c b/test/test-skeleton.c index 7967c5710..6b7a09164 100644 --- a/test/test-skeleton.c +++ b/test/test-skeleton.c @@ -193,7 +193,7 @@ timeout_handler (int sig __attribute__ ((unused))) int main (int argc, char *argv[]) { -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ int direct = 0; /* Directly call the test function? */ #else int direct = 1; diff --git a/test/unistd/fork.c b/test/unistd/fork.c index 20bbc5cff..e71462443 100644 --- a/test/unistd/fork.c +++ b/test/unistd/fork.c @@ -32,7 +32,7 @@ #define GOT2 (1 << 2) #define GOT3 (1 << 3) -#ifdef __ARCH_HAS_MMU__ +#ifdef __ARCH_USE_MMU__ void child_handler(int sig) { -- cgit v1.2.3