1 /*
   2  * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 #ifndef OS_CPU_LINUX_X86_ZGLOBALS_LINUX_X86_HPP
  25 #define OS_CPU_LINUX_X86_ZGLOBALS_LINUX_X86_HPP
  26 
  27 //
  28 // Page Allocation Tiers
  29 // ---------------------
  30 //
  31 //  Page Type     Page Size     Object Size Limit     Object Alignment
  32 //  ------------------------------------------------------------------
  33 //  Small         2M            <= 265K               <MinObjAlignmentInBytes>
  34 //  Medium        32M           <= 4M                 4K
  35 //  Large         X*M           > 4M                  2M
  36 //  ------------------------------------------------------------------
  37 //
  38 //
  39 // Address Space & Pointer Layout
  40 // ------------------------------
  41 //
  42 //  +--------------------------------+ 0x00007FFFFFFFFFFF (127TB)
  43 //  .                                .
  44 //  .                                .
  45 //  .                                .
  46 //  +--------------------------------+ 0x0000140000000000 (20TB)
  47 //  |         Remapped View          |
  48 //  +--------------------------------+ 0x0000100000000000 (16TB)
  49 //  |     (Reserved, but unused)     |
  50 //  +--------------------------------+ 0x00000c0000000000 (12TB)
  51 //  |         Marked1 View           |
  52 //  +--------------------------------+ 0x0000080000000000 (8TB)
  53 //  |         Marked0 View           |
  54 //  +--------------------------------+ 0x0000040000000000 (4TB)
  55 //  .                                .
  56 //  +--------------------------------+ 0x0000000000000000
  57 //
  58 //
  59 //   6                 4 4 4  4 4                                             0
  60 //   3                 7 6 5  2 1                                             0
  61 //  +-------------------+-+----+-----------------------------------------------+
  62 //  |00000000 00000000 0|0|1111|11 11111111 11111111 11111111 11111111 11111111|
  63 //  +-------------------+-+----+-----------------------------------------------+
  64 //  |                   | |    |
  65 //  |                   | |    * 41-0 Object Offset (42-bits, 4TB address space)
  66 //  |                   | |
  67 //  |                   | * 45-42 Metadata Bits (4-bits)  0001 = Marked0      (Address view 4-8TB)
  68 //  |                   |                                 0010 = Marked1      (Address view 8-12TB)
  69 //  |                   |                                 0100 = Remapped     (Address view 16-20TB)
  70 //  |                   |                                 1000 = Finalizable  (Address view N/A)
  71 //  |                   |
  72 //  |                   * 46-46 Unused (1-bit, always zero)
  73 //  |
  74 //  * 63-47 Fixed (17-bits, always zero)
  75 //
  76 
  77 const size_t    ZPlatformPageSizeSmallShift   = 21; // 2M
  78 
  79 const size_t    ZPlatformAddressOffsetBits    = 42; // 4TB
  80 
  81 const uintptr_t ZPlatformAddressMetadataShift = ZPlatformAddressOffsetBits;
  82 
  83 const uintptr_t ZPlatformAddressSpaceStart    = (uintptr_t)1 << ZPlatformAddressOffsetBits;
  84 const uintptr_t ZPlatformAddressSpaceSize     = ((uintptr_t)1 << ZPlatformAddressOffsetBits) * 4;
  85 
  86 const size_t    ZPlatformCacheLineSize        = 64;
  87 
  88 #endif // OS_CPU_LINUX_X86_ZGLOBALS_LINUX_X86_HPP