home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 9.ddi / usr / include / vm / hat.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  4.6 KB  |  152 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. /*
  11.  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  12.  *         PROPRIETARY NOTICE (Combined)
  13.  * 
  14.  * This source code is unpublished proprietary information
  15.  * constituting, or derived under license from AT&T's UNIX(r) System V.
  16.  * In addition, portions of such source code were derived from Berkeley
  17.  * 4.3 BSD under license from the Regents of the University of
  18.  * California.
  19.  * 
  20.  * 
  21.  * 
  22.  *         Copyright Notice 
  23.  * 
  24.  * Notice of copyright on this source code product does not indicate 
  25.  * publication.
  26.  * 
  27.  *     (c) 1986,1987,1988,1989  Sun Microsystems, Inc
  28.  *     (c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
  29.  *               All rights reserved.
  30.  *  
  31.  */
  32.  
  33. #ifndef _VM_HAT_H
  34. #define _VM_HAT_H
  35.  
  36. #ident    "@(#)/usr/include/vm/hat.h.sl 1.1 4.0 12/08/90 25113 AT&T-USL"
  37.  
  38. /*
  39.  * VM - Hardware Address Translation management.
  40.  *
  41.  * This file describes the machine independent interfaces to
  42.  * the hardware address translation management routines.  Other
  43.  * machine specific interfaces and structures are defined
  44.  * in <vm/vm_hat.h>.  The hat layer manages the address
  45.  * translation hardware as a cache driven by calls from the
  46.  * higher levels of the VM system.
  47.  */
  48.  
  49. #include "vm/vm_hat.h"
  50.  
  51. #ifdef _KERNEL
  52. /*
  53.  * One time hat initialization
  54.  */
  55. void    hat_init();
  56.  
  57. /*
  58.  * Operations on hat resources for an address space:
  59.  *    - initialize any needed hat structures for the address space
  60.  *    - free all hat resources now owned by this address space
  61.  *    - initialize any needed hat structures when the process is
  62.  *      swapped in.
  63.  *    - free all hat resources that are not needed while the process
  64.  *      is swapped out.
  65.  *    - dup any hat resources that can be created when duplicating
  66.  *      another process' address space.
  67.  *
  68.  * N.B. - The hat structure is guaranteed to be zeroed when created.
  69.  * The hat layer can choose to define hat_alloc as a macro to avoid
  70.  * a subroutine call if this is sufficient initialization.
  71.  */
  72. void    hat_alloc(/* as */);
  73. void    hat_free(/* as */);
  74. void    hat_swapin(/* as */);
  75. void    hat_swapout(/* as */);
  76. int    hat_dup(/* as */);
  77.  
  78. /* Operation to allocate/reserve mapping structures
  79.  *    - allocate/reserve mapping structures for a segment.
  80.  */
  81. u_int    hat_map(/* seg, vp, vp_base, prot, flags */);
  82.  
  83. /*
  84.  * Operations on a named address with in a segment:
  85.  *    - load/lock the given page struct
  86.  *    - load/lock the given page frame number
  87.  *    - unlock the given address
  88.  *
  89.  * (Perhaps we need an interface to load several pages at once?)
  90.  */
  91. void    hat_memload(/* seg, addr, pp, prot, flags */);
  92. void    hat_devload(/* seg, addr, ppid, prot, flags */);
  93. void    hat_unlock(/* seg, addr */);
  94.  
  95. /*
  96.  * Operations over an address range:
  97.  *    - change protections
  98.  *    - change mapping to refer to a new segment
  99.  *    - unload mapping
  100.  */
  101. void    hat_chgprot(/* seg, addr, len, prot */);
  102. void    hat_newseg(/* seg, addr, len, nseg */);
  103. void    hat_unload(/* seg, addr, len, flags */);
  104.  
  105. /*
  106.  * Operations that work on all active translation for a given page:
  107.  *    - unload all translations to page
  108.  *    - get hw stats from hardware into page struct and reset hw stats
  109.  */
  110. void    hat_pageunload(/* pp */);
  111. void    hat_pagesync(/* pp */);
  112.  
  113. /*
  114.  * Operations that return physical page IDs (ie - used by mapin):
  115.  *    - return the ppid for kernel virtual address
  116.  *    - return the ppid for arbitrary virtual address
  117.  *    - return the ppid for arbitrary physical address
  118.  *
  119.  * XXX - The second  one is not yet implemented - not yet needed.
  120.  * u_int hat_getpfnum(as, addr);
  121.  */
  122. u_int    hat_getkpfnum(/* addr */);
  123. u_int    hat_getppfnum(/* addr, pspace */);
  124.  
  125. /*
  126.  * Flags to pass to hat routines.
  127.  *
  128.  * Certain flags only apply to some interfaces:
  129.  *
  130.  *     HAT_NOFLAGS   No flags specified.
  131.  *     HAT_LOCK      Lock down mapping resources; hat_map(), hat_memload(),
  132.  *                   and hat_devload().
  133.  *     HAT_UNLOCK    Unlock mapping resources; hat_memload(), hat_devload(),
  134.  *                   and hat_unload().
  135.  *    HAT_PUTPP     VOP_PUTPAGE() pp if dirty and last mapping; hat_unload().
  136.  *     HAT_FREEPP    Free pp if unloading last mapping (implies HAT_PUTPP);
  137.  *              hat_unload().
  138.  *     HAT_RELEPP    PAGE_RELE() pp after mapping is unloaded; hat_unload().
  139.  *     HAT_PRELOAD   Pre-load pages for new segment; hat_map().
  140.  */
  141. #define    HAT_NOFLAGS    0x0
  142. #define    HAT_LOCK    0x1
  143. #define    HAT_UNLOCK    0x2
  144. #define    HAT_FREEPP    0x4
  145. #define    HAT_RELEPP    0x8
  146. #define    HAT_PRELOAD    0x10
  147. #define HAT_PUTPP    0x20
  148.  
  149. #endif /* _KERNEL */
  150.  
  151. #endif    /* _VM_HAT_H */
  152.