コード例 #1
0
 private void zeroBlock(Address block) {
   // FIXME: efficiency check here!
   if (VM.VERIFY_ASSERTIONS)
     VM.assertions._assert(
         block.toWord().and(Word.fromIntSignExtend(BYTES_IN_BLOCK - 1)).isZero());
   VM.memory.zero(block, Extent.fromIntZeroExtend(BYTES_IN_BLOCK));
 }
コード例 #2
0
 /**
  * Allows access to an area of virtual memory.
  *
  * @param start the address of the start of the area to be mapped
  * @param size the size, in bytes, of the area to be mapped
  * @return <code>true</code> if successful, otherwise <code>false</code>
  */
 public final boolean munprotect(Address start, int size) {
   return org.jikesrvm.runtime.Memory.mprotect(
       start,
       Extent.fromIntZeroExtend(size),
       org.jikesrvm.runtime.Memory.PROT_READ
           | org.jikesrvm.runtime.Memory.PROT_WRITE
           | org.jikesrvm.runtime.Memory.PROT_EXEC);
 }
コード例 #3
0
ファイル: Memory.java プロジェクト: vilay/check
 /**
  * Zero a region of memory
  *
  * @param start The start of the region to be zeroed (must be 4-byte aligned)
  * @param bytes The number of bytes to be zeroed (must be 4-byte aligned)
  */
 public static void zero(Address start, Extent bytes) throws InlinePragma {
   if (Assert.VERIFY_ASSERTIONS) {
     assertAligned(start);
     assertAligned(bytes);
   }
   if (bytes.GT(Extent.fromIntZeroExtend(SMALL_REGION_THRESHOLD)))
     org.mmtk.vm.Memory.zero(start, bytes);
   else zeroSmall(start, bytes);
 }
コード例 #4
0
 /**
  * Demand zero mmaps an area of virtual memory.
  *
  * @param start the address of the start of the area to be mapped
  * @param size the size, in bytes, of the area to be mapped
  * @return 0 if successful, otherwise the system errno
  */
 public final int dzmmap(Address start, int size) {
   Address result = org.jikesrvm.runtime.Memory.dzmmap(start, Extent.fromIntZeroExtend(size));
   if (result.EQ(start)) return 0;
   if (result.GT(Address.fromIntZeroExtend(127))) {
     VM.sysWrite("demand zero mmap with MAP_FIXED on ", start);
     VM.sysWriteln(" returned some other address", result);
     VM.sysFail("mmap with MAP_FIXED has unexpected behavior");
   }
   return result.toInt();
 }
コード例 #5
0
 /**
  * Protects access to an area of virtual memory.
  *
  * @param start the address of the start of the area to be mapped
  * @param size the size, in bytes, of the area to be mapped
  * @return <code>true</code> if successful, otherwise <code>false</code>
  */
 public final boolean mprotect(Address start, int size) {
   return org.jikesrvm.runtime.Memory.mprotect(
       start, Extent.fromIntZeroExtend(size), org.jikesrvm.runtime.Memory.PROT_NONE);
 }