home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Headers / mach / m68k / vm_param.h < prev    next >
Text File  |  1993-10-19  |  4KB  |  115 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.  *    the extra 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 64 MB of kernel virtual space */
  71. #define VM_MIN_KERNEL_ADDRESS    ((vm_offset_t) 0x10000000)
  72. #define VM_MAX_KERNEL_ADDRESS    ((vm_offset_t) 0x14000000)
  73.  
  74. #define    M68K_KERNEL_TEXT_ADDR    0x04000000
  75.  
  76. #define INTSTACK_SIZE        4096        /* interrupt stack size */
  77. #define    KERNSTACK_SIZE        4096        /* kernel stack size
  78.                          * Don't use this, use
  79.                          * KERNEL_STACK_SIZE from
  80.                          * <kern/kernel_stack.h>
  81.                          */
  82. #define    MAX_REGIONS        8        /* max regions of memory */
  83.  
  84. /*
  85.  *    Convert bytes to pages and convert pages to bytes.
  86.  *    No rounding is used.
  87.  */
  88.  
  89. #define    m68k_btop(x)    (((unsigned)(x)) >> m68k_page_shift)
  90. #define    m68k_ptob(x)    (((unsigned)(x)) << m68k_page_shift)
  91.  
  92. /*
  93.  *    Round off or truncate to the nearest page.  These will work
  94.  *    for either addresses or counts.  (i.e. 1 byte rounds to 1 page
  95.  *    bytes.
  96.  */
  97.  
  98. #define m68k_round_page(x)    ((((unsigned)(x)) + m68k_page_size - 1) & \
  99.                     ~(m68k_page_size-1))
  100. #define m68k_trunc_page(x)    (((unsigned)(x)) & ~(m68k_page_size-1))
  101.  
  102. /*
  103.  *    Conversion between m68k pages and VM pages.
  104.  */
  105.  
  106. #define trunc_m68k_to_vm(p)    (atop(trunc_page(m68k_ptob(p))))
  107. #define round_m68k_to_vm(p)    (atop(round_page(m68k_ptob(p))))
  108.  
  109. /*
  110.  * Maximum alignment required by any data type for this architecture.
  111.  * (Use 4 bytes for performance reasons....)
  112.  */
  113. #define    MAX_DATA_ALIGNMENT    4        /* 4 bytes */
  114. #endif    _MACH_M68K_VM_PARAM_
  115.