The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/mach/vm_param.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* 
    2  * Mach Operating System
    3  * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
    4  * All Rights Reserved.
    5  * 
    6  * Permission to use, copy, modify and distribute this software and its
    7  * documentation is hereby granted, provided that both the copyright
    8  * notice and this permission notice appear in all copies of the
    9  * software, derivative works or modified versions, and any portions
   10  * thereof, and that both notices appear in supporting documentation.
   11  * 
   12  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   13  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
   14  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   15  * 
   16  * Carnegie Mellon requests users of this software to return to
   17  * 
   18  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   19  *  School of Computer Science
   20  *  Carnegie Mellon University
   21  *  Pittsburgh PA 15213-3890
   22  * 
   23  * any improvements or extensions that they make and grant Carnegie Mellon
   24  * the rights to redistribute these changes.
   25  */
   26 /*
   27  * HISTORY
   28  * $Log:        vm_param.h,v $
   29  * Revision 2.5  93/01/14  17:49:06  danner
   30  *      Standardized include symbol name.
   31  *      [92/06/10            pds]
   32  *      64bit cleanup.
   33  *      [92/12/01            af]
   34  * 
   35  * Revision 2.4  91/05/14  17:02:53  mrt
   36  *      Correcting copyright
   37  * 
   38  * Revision 2.3  91/02/05  17:37:34  mrt
   39  *      Changed to new Mach copyright
   40  *      [91/02/01  17:22:32  mrt]
   41  * 
   42  * Revision 2.2  90/06/02  15:00:23  rpd
   43  *      Removed user definitions; added page_aligned.
   44  *      [90/03/26  22:42:42  rpd]
   45  * 
   46  * Revision 2.1  89/08/03  16:06:40  rwd
   47  * Created.
   48  * 
   49  * Revision 2.3  89/02/25  18:42:23  gm0w
   50  *      Changes for cleanup.
   51  * 
   52  * 15-May-87  Avadis Tevanian (avie) at Carnegie-Mellon University
   53  *      Coalesced includes, documented use of PAGE_SIZE and PAGE_SHIFT.
   54  *
   55  * 15-Nov-86  Avadis Tevanian (avie) at Carnegie-Mellon University
   56  *      Removed include of <mach_init.h> before non-kernel definitions
   57  *      of trunc/round page macros.  When this is included, it makes it
   58  *      impossible for user programs to include system header files to
   59  *      retrieve kernel data structures.  (For example, the user level
   60  *      mach_init will cause a task to be a port, making it impossible
   61  *      to get the real kernel definition of a task).
   62  *
   63  *  7-Nov-86  Michael Young (mwyoung) at Carnegie-Mellon University
   64  *      Added non-KERNEL definitions of round_page, trunc_page.
   65  *
   66  * 21-May-86  David Golub (dbg) at Carnegie-Mellon University
   67  *      Added page_mask.  Changed types of page_size and page_mask
   68  *      to vm_size_t.
   69  *
   70  *  9-Jun-85  Avadis Tevanian (avie) at Carnegie-Mellon University
   71  *      Created.
   72  *
   73  */
   74 /*
   75  *      File:   mach/vm_param.h
   76  *      Author: Avadis Tevanian, Jr., Michael Wayne Young
   77  *      Date:   1985
   78  *
   79  *      Machine independent virtual memory parameters.
   80  *
   81  */
   82 
   83 #ifndef _MACH_VM_PARAM_H_
   84 #define _MACH_VM_PARAM_H_
   85 
   86 #ifndef KERNEL
   87 
   88 ;YOU HAVE MADE A MISTAKE BY INCLUDING THIS FILE;
   89 
   90 THIS FILE SHOULD NOT BE VISIBLE TO USER PROGRAMS.
   91 
   92 USE <mach/machine/vm_param.h> TO GET MACHINE-DEPENDENT ADDRESS
   93 SPACE AND PAGE SIZE ITEMS.
   94 
   95 USE <mach/machine/vm_types.h> TO GET TYPE DECLARATIONS USED IN
   96 THE MACH KERNEL INTERFACE.
   97 
   98 IN ALL PROBABILITY, YOU SHOULD GET ALL OF THE TYPES USED IN THE
   99 INTERFACE FROM <mach/mach_types.h>
  100 
  101 #endif  /* KERNEL */
  102 
  103 #include <mach/machine/vm_param.h>
  104 #include <mach/machine/vm_types.h>
  105 
  106 /*
  107  *      The machine independent pages are refered to as PAGES.  A page
  108  *      is some number of hardware pages, depending on the target machine.
  109  */
  110 
  111 /*
  112  *      All references to the size of a page should be done with PAGE_SIZE
  113  *      or PAGE_SHIFT.  The fact they are variables is hidden here so that
  114  *      we can easily make them constant if we so desire.
  115  */
  116 
  117 /*
  118  *      Regardless whether it is implemented with a constant or a variable,
  119  *      the PAGE_SIZE is assumed to be a power of two throughout the
  120  *      virtual memory system implementation.
  121  */
  122 
  123 #ifndef PAGE_SIZE_FIXED
  124 #define PAGE_SIZE       page_size       /* size of page in addressible units */
  125 #define PAGE_SHIFT      page_shift      /* number of bits to shift for pages */
  126 #endif  /* PAGE_SIZE_FIXED */
  127 
  128 #ifndef ASSEMBLER
  129 /*
  130  *      Convert addresses to pages and vice versa.
  131  *      No rounding is used.
  132  */
  133 
  134 #define atop(x)         (((vm_size_t)(x)) >> page_shift)
  135 #define ptoa(x)         ((vm_offset_t)((x) << page_shift))
  136 
  137 /*
  138  *      Round off or truncate to the nearest page.  These will work
  139  *      for either addresses or counts.  (i.e. 1 byte rounds to 1 page
  140  *      bytes.
  141  */
  142 
  143 #define round_page(x)   ((vm_offset_t)((((vm_offset_t)(x)) + page_mask) & ~page_mask))
  144 #define trunc_page(x)   ((vm_offset_t)(((vm_offset_t)(x)) & ~page_mask))
  145 
  146 /*
  147  *      Determine whether an address is page-aligned, or a count is
  148  *      an exact page multiple.
  149  */
  150 
  151 #define page_aligned(x) ((((vm_offset_t) (x)) & page_mask) == 0)
  152 
  153 #ifndef PAGE_SIZE_FIXED
  154 extern vm_size_t        page_size;      /* machine independent page size */
  155 extern vm_size_t        page_mask;      /* page_size - 1; mask for
  156                                                    offset within page */
  157 extern int              page_shift;     /* shift to use for page size */
  158 #else   /* PAGE_SIZE_FIXED */
  159 #define page_mask       (PAGE_SIZE-1)
  160 #endif  /* PAGE_SIZE_FIXED */
  161 
  162 extern vm_size_t        mem_size;       /* size of physical memory (bytes) */
  163 extern vm_offset_t      first_addr;     /* first physical page */
  164 extern vm_offset_t      last_addr;      /* last physical page */
  165 
  166 #endif  /* ASSEMBLER */
  167 #endif  /* _MACH_VM_PARAM_H_ */

Cache object: c2da125cb95f4bbedf3667d45a3cf65d


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.