am c8ba22c8: Merge "Move PAGE_MASK into <sys/user.h>."

* commit 'c8ba22c847bd5bfc97d29a4c565fd32993200a01':
  Move PAGE_MASK into <sys/user.h>.
This commit is contained in:
Elliott Hughes 2015-07-29 00:05:13 +00:00 committed by Android Git Automerger
commit a3c3a6b2df
5 changed files with 40 additions and 22 deletions

View File

@ -49,16 +49,10 @@
#include "libc_init_common.h" #include "libc_init_common.h"
#include "pthread_internal.h" #include "pthread_internal.h"
#include "private/bionic_page.h"
#include "private/bionic_tls.h" #include "private/bionic_tls.h"
#include "private/KernelArgumentBlock.h" #include "private/KernelArgumentBlock.h"
// Returns the address of the page containing address 'x'.
#define PAGE_START(x) ((x) & PAGE_MASK)
// Returns the address of the next page after address 'x', unless 'x' is
// itself at the start of a page.
#define PAGE_END(x) PAGE_START((x) + (PAGE_SIZE-1))
extern "C" int __cxa_atexit(void (*)(void *), void *, void *); extern "C" int __cxa_atexit(void (*)(void *), void *, void *);
static void call_array(void(**list)()) { static void call_array(void(**list)()) {

View File

@ -89,9 +89,6 @@
#define PAGESIZE PAGE_SIZE #define PAGESIZE PAGE_SIZE
#endif #endif
/* glibc's PAGE_MASK is the bitwise negation of BSD's! TODO: remove? */
#define PAGE_MASK (~(PAGE_SIZE - 1))
#define SEM_VALUE_MAX 0x3fffffff #define SEM_VALUE_MAX 0x3fffffff
/* POSIX says these belong in <unistd.h> but BSD has some in <limits.h>. */ /* POSIX says these belong in <unistd.h> but BSD has some in <limits.h>. */

View File

@ -35,6 +35,9 @@
__BEGIN_DECLS __BEGIN_DECLS
#define PAGE_SIZE 4096
#define PAGE_MASK (~(PAGE_SIZE - 1))
#if __i386__ #if __i386__
struct user_fpregs_struct { struct user_fpregs_struct {

View File

@ -0,0 +1,33 @@
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _BIONIC_PAGE_H_
#define _BIONIC_PAGE_H_
// Get PAGE_SIZE and PAGE_MASK.
#include <sys/user.h>
// Returns the address of the page containing address 'x'.
#define PAGE_START(x) ((x) & PAGE_MASK)
// Returns the offset of address 'x' in its page.
#define PAGE_OFFSET(x) ((x) & ~PAGE_MASK)
// Returns the address of the next page after address 'x', unless 'x' is
// itself at the start of a page.
#define PAGE_END(x) PAGE_START((x) + (PAGE_SIZE-1))
#endif // _BIONIC_PAGE_H_

View File

@ -29,13 +29,14 @@
#ifndef _LINKER_H_ #ifndef _LINKER_H_
#define _LINKER_H_ #define _LINKER_H_
#include <android/dlext.h>
#include <elf.h> #include <elf.h>
#include <inttypes.h> #include <inttypes.h>
#include <link.h> #include <link.h>
#include <unistd.h>
#include <android/dlext.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h>
#include "private/bionic_page.h"
#include "private/libc_logging.h" #include "private/libc_logging.h"
#include "linked_list.h" #include "linked_list.h"
@ -77,16 +78,6 @@
#define ELF64_R_TYPE(info) (((info) >> 56) & 0xff) #define ELF64_R_TYPE(info) (((info) >> 56) & 0xff)
#endif #endif
// Returns the address of the page containing address 'x'.
#define PAGE_START(x) ((x) & PAGE_MASK)
// Returns the offset of address 'x' in its page.
#define PAGE_OFFSET(x) ((x) & ~PAGE_MASK)
// Returns the address of the next page after address 'x', unless 'x' is
// itself at the start of a page.
#define PAGE_END(x) PAGE_START((x) + (PAGE_SIZE-1))
#define FLAG_LINKED 0x00000001 #define FLAG_LINKED 0x00000001
#define FLAG_EXE 0x00000004 // The main executable #define FLAG_EXE 0x00000004 // The main executable
#define FLAG_LINKER 0x00000010 // The linker itself #define FLAG_LINKER 0x00000010 // The linker itself