Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 703538 | Differences between
and this patch

Collapse All | Expand All

(-)a/js/src/jit/ProcessExecutableMemory.cpp (+25 lines)
Lines 324-330 static void* ComputeRandomAllocationAddress() { Link Here
324
  // x64 CPUs have a 48-bit address space and on some platforms the OS will
324
  // x64 CPUs have a 48-bit address space and on some platforms the OS will
325
  // give us access to 47 bits, so to be safe we right shift by 18 to leave
325
  // give us access to 47 bits, so to be safe we right shift by 18 to leave
326
  // 46 bits.
326
  // 46 bits.
327
#  ifdef __ia64__
328
  // On ia64 virtual address space looks like one of:
329
  //   virt_addr_64 = [ <63..61> | <unimplemented> | L3 | L2 | L1 | offset ]
330
  //   virt_addr_64 = [ <63..61> | <unimplemented> | L4 | L3 | L2 | L1 | offset ]
331
  // where L{1..L4} are page tables. Each page table (except top-level L3 or L4)
332
  // is itself a page-size entry and can store PageSize / 8 entries. Top-level
333
  // entry is 1/8 of of L1/L2 (as 3 upper bits are part of <63..61> address part).
334
  // Note: that makes addressable size directly depend on page size.
335
  //
336
  // We conservatively assume 3 levels of page tables here. This makes the
337
  // following formula:
338
  //   L3     = log2(PAGE / 8 / 8) = log2(PAGE / 8) - 3
339
  //   L2                          = log2(PAGE / 8)
340
  //   L1                          = log2(PAGE / 8)
341
  //   offset = log2(PAGE)         = log2(PAGE / 8) + 3
342
  // thus
343
  //  L3 + L2 + L1 + offset = 4 * log2(PAGE / 8)
344
  // For more details see http://www.ia64-linux.org/doc/IA64linuxkernel.PDF
345
  // (slide 19: "user regions").
346
  static uint64_t ia64_virt_bits = std::min<uint64_t>(
347
    4 * (mozilla::FloorLog2(gc::SystemPageSize() / 8)),
348
    46);
349
  rand >>= (64 - ia64_virt_bits);
350
#  else
327
  rand >>= 18;
351
  rand >>= 18;
352
#  endif
328
#  else
353
#  else
329
  // On 32-bit, right shift by 34 to leave 30 bits, range [0, 1GiB). Then add
354
  // On 32-bit, right shift by 34 to leave 30 bits, range [0, 1GiB). Then add
330
  // 512MiB to get range [512MiB, 1.5GiB), or [0x20000000, 0x60000000). This
355
  // 512MiB to get range [512MiB, 1.5GiB), or [0x20000000, 0x60000000). This

Return to bug 703538