Package org.vmmagic.unboxed

Examples of org.vmmagic.unboxed.Extent


        if (srcOfs + length > src.length) {
            throw new IndexOutOfBoundsException("srcOfs + length > src.length");
        }
        testMemPtr(dstPtr, length * 8);
        final Address srcPtr = VmMagic.getArrayData(src).add(srcOfs * 8);
        final Extent size = Extent.fromIntZeroExtend(length * 8);
        Unsafe.copy(srcPtr, start.add(dstPtr), size);
    }
View Full Code Here


     * @see org.jnode.system.resource.MemoryResource#copy(int, int, int)
     */
    public void copy(int srcMemPtr, int destMemPtr, int length) {
        testMemPtr(srcMemPtr, length);
        testMemPtr(destMemPtr, length);
        final Extent size = Extent.fromIntZeroExtend(length);
        Unsafe.copy(start.add(srcMemPtr), start.add(destMemPtr), size);
    }
View Full Code Here

     *         available.
     */
    private static MemoryResource loadInitJar(ResourceManager rm) {
        final Address start = Unsafe.getInitJarStart();
        final Address end = Unsafe.getInitJarEnd();
        final Extent size = end.toWord().sub(start.toWord()).toExtent();
        if (size.toWord().isZero()) {
            // No initial jarfile
            BootLogInstance.get().info("No initial jarfile found");
            return null;
        } else {
            BootLogInstance.get().info("Found initial jarfile of " + size.toInt() + 'b');
            try {
                final ResourceOwner owner = new SimpleResourceOwner("System");
                return rm.claimMemoryResource(owner, start, size,
                    ResourceManager.MEMMODE_NORMAL);
            } catch (ResourceNotFreeException ex) {
View Full Code Here

                throw new ArrayStoreException("Unknown array type");
        }

        final Address srcPtr = srcAddr.add(dataOffset + (srcPos * elemsize));
        final Address dstPtr = dstAddr.add(dataOffset + (dstPos * elemsize));
        final Extent size = Extent.fromIntZeroExtend(length * elemsize);


        if (isObjectArray) {
            Class dst_comp_class = dst_class.getComponentType();
            Class src_comp_class = src_class.getComponentType();
View Full Code Here

    protected static ResourceManager initialize() {
        try {
            final Address kernelStart = Unsafe.getKernelStart();
            final Address kernelEnd = Unsafe.getKernelEnd();
            final Extent kernelSize = kernelEnd.toWord().sub(kernelStart.toWord()).toExtent();
            MemoryResourceImpl
                .claimMemoryResource(new SimpleResourceOwner("kernel"), kernelStart, kernelSize, MEMMODE_NORMAL);

            final Address bootHeapStart = Unsafe.getBootHeapStart();
            final Address bootHeapEnd = Unsafe.getBootHeapEnd();
            final Extent bootHeapSize = bootHeapEnd.toWord().sub(bootHeapStart.toWord()).toExtent();
            MemoryResourceImpl
                .claimMemoryResource(new SimpleResourceOwner("bootheap"), bootHeapStart, bootHeapSize, MEMMODE_NORMAL);

            ResourceManager rm = new ResourceManagerImpl();
            InitialNaming.bind(NAME, rm);
View Full Code Here

     * @param start
     * @param bits
     */
    public final void initialize(Address start, Word bits) {
        // Size of the lock (we only use an int)
        final Extent lockSize = Extent.fromIntZeroExtend(VmUtils.getVm().getArch()
            .getReferenceSize());

        // Create a lock and actual bitmap
        final Extent rawBitmapSize = bits.rshl(3).toExtent();
        final Extent bitmapSize = rawBitmapSize.toWord().add(lockSize)
            .toExtent();

        this.start = start;
        this.end = start.add(bitmapSize);
        this.bits = bits;
View Full Code Here

                    rm.claimMemoryResource(device, Address.fromIntZeroExtend(fbBase), memSize,
                            ResourceManager.MEMMODE_NORMAL);

            // Map MMIO block 0, first test for 8Mb framebuffers.
            Offset block0Ofs = Offset.fromIntZeroExtend(0x7ffc00);
            Extent mmioSize = Extent.fromIntZeroExtend(1024); // 1K
            MemoryResource mmio0 = deviceRam.claimChildResource(block0Ofs, mmioSize, false);
            Mach64VgaIO io = new Mach64VgaIO(deviceRam, mmio0);
            if ((io.getReg32(CONFIG_CHIP_ID) & CFG_CHIP_TYPE) != pciCfg.getDeviceID()) {
                // Try for 4Mb framebuffers.
                mmio0.release();
View Full Code Here

     * Gets the size of free memory in bytes.
     *
     * @return long
     */
    public long getFreeMemory() {
        Extent size = Extent.zero();
        VmDefaultHeap h = firstNormalHeap;
        while (h != null) {
            size = size.add(h.getFreeSize());
            h = h.getNext();
        }
        // size += (Unsafe.addressToLong(heapEnd) -
        // Unsafe.addressToLong(nextHeapPtr));
        size = size.add(Extent.fromLong(MemoryBlockManager.getFreeMemory()));
        return size.toLong();
    }
View Full Code Here

        for (MemoryMapEntry e : mmap) {
            if (e.isAcpi() || e.isAcpiNVS()) {
                // Calculate page aligned boundaries & sizes
                final Address alignedPhysStart = arch.pageAlign(ACPI, e.getStart(), false);
                final Word diff = e.getStart().toWord().sub(alignedPhysStart.toWord());
                final Extent size = e.getSize().add(diff);

                // Check for adjacent memory blocks
                if (lastAcpiEntry != null) {
                    Address expected = lastAcpiEntry.getStart().add(lastAcpiEntry.getSize());
                    if (e.getStart().NE(expected)) {
View Full Code Here

        ((MemoryRawData) address).resource.setBytes(src, offset, index, length);
    }

    static Pointer adjustAddress(Pointer address, int offset) {
        final MemoryResource res = ((MemoryRawData) address).resource;
        final Extent size = res.getSize().sub(offset);
        try {
            return new MemoryRawData(res.claimChildResource(Offset.fromIntZeroExtend(offset), size, true));
        } catch (ResourceNotFreeException ex) {
            throw new Error("Cannot adjustAddress", ex);
        }
View Full Code Here

TOP

Related Classes of org.vmmagic.unboxed.Extent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.