home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilss / sockets / include / sys / h / cmap < prev    next >
Encoding:
Text File  |  1995-01-11  |  3.5 KB  |  126 lines

  1. /*
  2.  * $Header: /ax/networking:include/sys/cmap.h:networking  1.1  $
  3.  * $Source: /ax/networking:include/sys/cmap.h: $
  4.  *
  5.  * Copyright (c) 1988 Acorn Computers Ltd., Cambridge, England
  6.  *
  7.  * $Log:    cmap.h,v $
  8.  * Revision 1.1  95/01/11  10:19:00  kwelton
  9.  * Initial revision
  10.  * 
  11.  * Revision 1.3  88/06/17  20:18:29  beta
  12.  * Acorn Unix initial beta version
  13.  * 
  14.  */
  15. /* @(#)cmap.h    1.5 87/07/09 3.2/4.3NFSSRC */
  16. /*
  17.  * Copyright (c) 1982, 1986 Regents of the University of California.
  18.  * All rights reserved.  The Berkeley software License Agreement
  19.  * specifies the terms and conditions for redistribution.
  20.  *
  21.  *    @(#)cmap.h    7.1 (Berkeley) 6/4/86
  22.  */
  23.  
  24. /*
  25.  *
  26.  * THESE COMMENTS NEED UPDATING FOR THE ARM
  27.  *
  28.  * core map entry
  29.  *
  30.  * Limits imposed by this structure:
  31.  *
  32.  *        limit             cur. size        fields
  33.  *    Physical memory*        64 Mb    c_next, c_prev, c_hlink
  34.  *    Mounted filesystems        255    c_mdev
  35.  *    size of a process segment    1 Gb    c_page
  36.  *    filesystem size            8 Gb    c_blkno
  37.  *    proc, text table size        64K    c_ndx
  38.  *
  39.  *    * memory can be expanded by converting first three entries
  40.  *    to bit fields of larger than 16 bits, shrinking c_ndx accordingly,
  41.  *    and increasing MAXMEM below.  Also, the type of cmhash
  42.  *    (below) must be changed to long.
  43.  */
  44. #ifndef    LOCORE
  45. struct cmap
  46. {
  47. #ifdef    vax
  48. unsigned short     c_next,        /* index of next free list entry */
  49.         c_prev,        /* index of previous free list entry */
  50.         c_hlink;    /* hash link for <blkno,mdev> */
  51. unsigned short    c_ndx;        /* index of owner proc or text */
  52. #endif    vax
  53. #ifdef    arm
  54. unsigned int     c_next,        /* index of next free list entry */
  55.         c_prev,        /* index of previous free list entry */
  56.         c_hlink;    /* hash link for <blkno,mdev> */
  57. unsigned int    c_ndx;        /* index of owner proc or text */
  58. #endif    arm
  59. unsigned int    c_page:21,    /* virtual page number in segment */
  60.         c_lock:1,    /* locked for raw i/o or pagein */
  61.         c_want:1,    /* wanted */
  62.         c_intrans:1,    /* intransit bit */
  63.         c_free:1,    /* on the free list */
  64.         c_gone:1,    /* associated page has been released */
  65.         c_type:3,    /* type CSYS, CTEXT, CSTACK, CDATA or CSHM */
  66.         :3,        /* to longword boundary */
  67.         c_blkno:24,    /* disk block this is a copy of */
  68.         c_mdev:8;    /* which mounted dev this is from */
  69. struct vnode    *c_vp;          /* vnode to which c_blkno refers */
  70. };
  71. #else    LOCORE
  72. /*
  73.  * bit offsets of elements in cmap
  74.  */
  75. #define    C_INTRANS    87
  76. #define    C_FREE        88
  77. #define    SZ_CMAP        20        /* sizeof(struct cmap) */
  78.  
  79. #define    MAXMEM        64*1024        /* maximum memory, in Kbytes */
  80. #endif    LOCORE
  81.  
  82. #define    CMHEAD    0
  83.  
  84. /*
  85.  * Shared text pages are not totally abandoned when a process
  86.  * exits, but are remembered while in the free list hashed by <vp,blkno>
  87.  * off the cmhash structure so that they can be reattached
  88.  * if another instance of the program runs again soon.
  89.  */
  90. #define    CMHSIZ    2048        /* SHOULD BE DYNAMIC */
  91. #define    CMHASH(bn)    ((bn)&(CMHSIZ-1))
  92.  
  93. #ifndef    LOCORE
  94. #ifdef    KERNEL
  95. #ifdef    DYNALLOC
  96. struct    cmap *cmap;
  97. #else    DYNALLOC
  98. struct    cmap stat_cmap[NCMAP], *cmap;
  99. #endif    DYNALLOC
  100. struct    cmap *ecmap;
  101. int    ncmap;
  102. struct    cmap *mfind();
  103. int    firstfree, maxfree;
  104. int    ecmx;            /* cmap index of ecmap */
  105. #ifdef    vax
  106. u_short    cmhash[CMHSIZ];
  107. #endif    vax
  108. #ifdef    arm
  109. u_int    cmhash[CMHSIZ];
  110. #endif    arm
  111. #endif
  112.  
  113. /* bits defined in c_type */
  114.  
  115. #define    CSYS        0        /* none of below */
  116. #define    CTEXT        1        /* belongs to shared text segment */
  117. #define    CDATA        2        /* belongs to data segment */
  118. #define    CSTACK        3        /* belongs to stack segment */
  119. #define CSHM        4        /* belongs to shared memory segment */
  120.  
  121. #define    pgtocm(x)    (((int) ((x)-firstfree) / CLSIZE) + 1)
  122. #define    cmtopg(x)    ((((x)-1) * CLSIZE) + firstfree)
  123. #endif    LOCORE
  124.  
  125. /* EOF cmap.h */
  126.