home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.0 / NeXTSTEP3.0.iso / NextDeveloper / Headers / mach / m68k / vm_param.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-30  |  3.4 KB  |  104 lines

  1. /* 
  2.  * Copyright (c) 1987 NeXT, Inc.
  3.  *
  4.  * HISTORY
  5.  * 15-May-91  Gregg Kellogg (gk) at NeXT
  6.  *    Converted NeXT_ stuff to m68k_ stuff.
  7.  */ 
  8.  
  9. #ifndef    _MACH_M68K_VM_PARAM_
  10. #define    _MACH_M68K_VM_PARAM_
  11.  
  12. #import <bsd/sys/types.h>
  13.  
  14. #define BYTE_SIZE    8    /* byte size in bits */
  15. #define BYTE_MSF    1    /* Most significant byte first in word */
  16.  
  17. /*
  18.  *    These are variables so we can change the page size by just rebooting.
  19.  */
  20.  
  21. #ifndef    ASSEMBLER
  22. extern int
  23.     m68k_page_size,        /* bytes per m68k page */
  24.     m68k_page_mask,        /* mask for page offset */
  25.     m68k_page_shift,    /* number of bits to shift for pages */
  26.     m68k_is,        /* initial shift: # of high VA bits to skip */
  27.     m68k_tia,        /* table index a */
  28.     m68k_tib,        /* table index b */
  29.     m68k_pt1_entries,    /* number of entries per level 1 page table */
  30.     m68k_pt2_entries,
  31.     m68k_pt1_size,        /* size of a single level 1 page table */
  32.     m68k_pt2_size,
  33.     m68k_pt1_shift,        /* bits to shift for pt1 index */
  34.     m68k_pt2_shift,
  35.     m68k_pt1_mask,        /* mask to apply for pt1 index */
  36.     m68k_pt2_mask,
  37.     m68k_pt2_maps;        /* a single pt2 maps this much VA space */
  38. #endif    ASSEMBLER
  39.  
  40. /*
  41.  *    Most ports place the kernel in the high half of the total
  42.  *    32-bit virtual address (VA) space, the u-area and kernel stack
  43.  *    just below that and the user space starting at virtual
  44.  *    location zero.  We disagree with this for several reasons
  45.  *    (on the VAX the hardware gives you no choice).  The user
  46.  *    should be able to address the entire 4GB virtual space now
  47.  *    that Mach makes better use of virtual memory concepts
  48.  *    (mapped files, shared memory, copy-on-write etc.) -- we need
  49.  *    t&Dxtra 2GB for these things.
  50.  *
  51.  *    Some processes may also want to use the MMU transparent
  52.  *    translation (tt) registers to access devices (e.g. video memory)
  53.  *    without constantly invalidating the MMU address translation cache.
  54.  *    Because the MMU tt registers map chunks of VA space directly to
  55.  *    their corresponding physical address (PA) spaces this fragments
  56.  *    the space even more and we'll need more VA space to compensate for it.
  57.  *    Another goal is catching illegal zero pointer references
  58.  *    in both the kernel and user address spaces.
  59.  *    We'd also like to use the MMU tt registers to bypass address
  60.  *    translation for the kernel text, data, bss and system page table
  61.  *    areas.
  62.  */
  63.  
  64. #define    M68K_MIN_PAGE_SIZE    8192
  65. #define    M68K_MAX_PAGE_SIZE    32768
  66.  
  67. #define    VM_MIN_ADDRESS    ((vm_offset_t) 0)
  68. #define    VM_MAX_ADDRESS    ((vm_offset_t) 0xfffffffc)
  69.  
  70. /* allow 32 MB of kernel virtual space */
  71. #define VM_MIN_KERNEL_ADDRESS    ((vm_offset_t) 0x10000000)
  72. #define VM_MAX_KERNEL_ADDRESS    ((vm_offset_t) 0x12000000)
  73.  
  74. #define    M68K_KERNEL_TEXT_ADDR    0x04000000
  75.  
  76. #define INTSTACK_SIZE        4096        /* interrupt stack size */
  77. #define    MAX_REGIONS        8        /* max regions of memory */
  78.  
  79. /*
  80.  *    Convert bytes to pages and convert pages to bytes.
  81.  *    No rounding is used.
  82.  */
  83.  
  84. #define    m68k_btop(x)    (((unsigned)(x)) >> m68k_page_shift)
  85. #define    m68k_ptob(x)    (((unsigned)(x)) << m68k_page_shift)
  86.  
  87. /*
  88.  *    Round off or truncate to the nearest page.  These will work
  89.  *    for either addresses or counts.  (i.e. 1 byte rounds to 1 page
  90.  *    bytes.
  91.  */
  92.  
  93. #define m68k_round_page(x)    ((((unsigned)(x)) + m68k_page_size - 1) & \
  94.                     ~(m68k_page_size-1))
  95. #define m68k_trunc_page(x)    (((unsigned)(x)) & ~(m68k_page_size-1))
  96.  
  97. /*
  98.  *    Conversion between m68k pages and VM pages.
  99.  */
  100.  
  101. #define trunc_m68k_to_vm(p)    (atop(trunc_page(m68k_ptob(p))))
  102. #define round_m68k_to_vm(p)    (atop(round_page(m68k_ptob(p))))
  103. #endif    _MACH_M68K_VM_PARAM_
  104.