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/i386/phys.c

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) 1993,1991,1990,1989 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:        phys.c,v $
   29  * Revision 2.9  93/11/17  16:37:48  dbg
   30  *      De-linted.  Removed copy_to_phys and copy_from_phys
   31  *      (unused).
   32  *      [93/09/29            dbg]
   33  * 
   34  * Revision 2.8  91/05/18  14:30:02  rpd
   35  *      Added vm_page_fictitious_addr assertions.
   36  *      [91/04/10            rpd]
   37  * 
   38  * Revision 2.7  91/05/14  16:13:29  mrt
   39  *      Correcting copyright
   40  * 
   41  * Revision 2.6  91/05/08  12:41:06  dbg
   42  *      More cleanup.
   43  *      [91/03/21            dbg]
   44  * 
   45  * Revision 2.5  91/03/16  14:45:06  rpd
   46  *      Added resume, continuation arguments to vm_fault.
   47  *      [91/02/05            rpd]
   48  * 
   49  * Revision 2.4  91/02/05  17:13:36  mrt
   50  *      Changed to new Mach copyright
   51  *      [91/02/01  17:36:36  mrt]
   52  * 
   53  * Revision 2.3  90/12/04  14:46:19  jsb
   54  *      Changes for merged intel/pmap.{c,h}.
   55  *      [90/12/04  11:17:19  jsb]
   56  * 
   57  * Revision 2.2  90/05/03  15:35:56  dbg
   58  *      Use 'write' bit in pte instead of protection field.
   59  *      [90/03/25            dbg]
   60  * 
   61  *      Use bzero instead of bclear.
   62  *      [90/02/15            dbg]
   63  * 
   64  * Revision 1.3  89/02/26  12:32:59  gm0w
   65  *      Changes for cleanup.
   66  * 
   67  */
   68  
   69 #include <mach/boolean.h>
   70 #include <kern/task.h>
   71 #include <kern/thread.h>
   72 #include <vm/vm_map.h>
   73 #include <mach/vm_param.h>
   74 #include <mach/vm_prot.h>
   75 #include <vm/vm_kern.h>
   76 #include <vm/vm_page.h>
   77 
   78 #include <i386/pmap.h>
   79 #include <mach/i386/vm_param.h>
   80 
   81 #include <kern/memory.h>        /* bcopy, bzero */
   82 
   83 /*
   84  *      kvtophys(addr)
   85  *
   86  *      Convert a kernel virtual address to a physical address
   87  */
   88 vm_offset_t
   89 kvtophys(
   90         vm_offset_t addr)
   91 {
   92         pt_entry_t *pte;
   93 
   94         if ((pte = pmap_pte(kernel_pmap, addr)) == PT_ENTRY_NULL)
   95                 return 0;
   96         return i386_trunc_page(*pte) | (addr & INTEL_OFFMASK);
   97 }
   98 
   99 /*
  100  *      pmap_zero_page zeros the specified (machine independent) page.
  101  */
  102 void pmap_zero_page(
  103         vm_offset_t p)
  104 {
  105         assert(p != vm_page_fictitious_addr);
  106         bzero((void *) phystokv(p), PAGE_SIZE);
  107 }
  108 
  109 /*
  110  *      pmap_copy_page copies the specified (machine independent) pages.
  111  */
  112 void pmap_copy_page(
  113         vm_offset_t src,
  114         vm_offset_t dst)
  115 {
  116         assert(src != vm_page_fictitious_addr);
  117         assert(dst != vm_page_fictitious_addr);
  118 
  119         bcopy((void *) phystokv(src), (void *) phystokv(dst), PAGE_SIZE);
  120 }
  121 

Cache object: 6f2a07b2ddd7a3f28f9f09c91737843a


[ 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.