CPU Simulator
    Preparing search index...

    This class represents a Memory Management Unit (MMU). This specialized execution unit is responsible for translating virtual memory addresses into physical memory addresses.

    Erik Burmester erik.burmester@nextbeam.net

    Index

    Constructors

    Properties

    ACCESSABLE_ONLY_IN_KERNEL_MODE_FLAG_INDEX: number = 3

    This class member stores the index of the flag bit, which indicates whether a page frame can be accessed only on kernel mode.

    CHANGED_FLAG_INDEX: number = 5

    This class member stores the index of the changed flag bit.

    EXECUTABLE_FLAG_INDEX: number = 2

    This class member stores the index of the executable flag bit.

    NUMBER_BITS_OFFSET: number = 12

    This class member stores the number of bits used for the offset in pages and page frames.

    NUMBER_BITS_PAGE_ADDRESS: number = ...

    This class member stores the number of bits representing the page number. The page number can be extracted from a virtual memory address by removing the offset bits from the right.

    NUMBER_BITS_PAGE_FRAME_ADDRESS: number = MemoryManagementUnit.NUMBER_BITS_PAGE_ADDRESS

    This class member stores the number of bits representing the page frame number. The page frame number can be extracted from a phyiscal memory address by removing the offset bits from the right.

    NUMBER_FLAG_BITS: number = 12

    This class member stores the number of bits used for the page table entries flag bits.

    PINNED_FLAG_INDEX: number = 4

    This class member stores the index of the pinned flag bit.

    PRESENT_FLAG_INDEX: number = 0

    This class member stores the index of the present flag bit.

    WRITABLE_FLAG_INDEX: number = 1

    This class member stores the index of the writable flag bit.

    Methods

    • This method clears all bits at the specified locations, depending on the given number of bytes.

      Parameters

      • virtualAddress: VirtualAddress

        The virtual address to clear all bits at.

      • length: DataSizes

        The number of bytes to clear, starting at the given physical address.

      Returns void

      If the page the given virtual address is part of, is currently not associated with a page frame.

      If the page frame associated with this page is not accessable in user mode.

      If the page frame associated with this page is not executable.

      If the page frame associated with this page is not writable.

    • This method tries to read a byte from the specified memory address. Returns a binary zero for address not conatined in the map in order to simulate a full size memory.

      Parameters

      • virtualAddress: VirtualAddress

        A binary value representing a virtual memory address to write the data to.

      Returns Byte

      The byte of data found at the specified address.

      If the page the given virtual address is part of, is currently not associated with a page frame.

      If the page frame associated with this page is not accessable in user mode.

      If the page frame associated with this page is not executable.

      If the page frame associated with this page is not writable.

    • This method reads doubleword sized data from the main memory starting at the specified physical memory address.

      Parameters

      • virtualAddress: VirtualAddress

        A binary virtual memory address to read the doubleword-sized data from.

      • attemptsToExecute: boolean

        Whether the reading process attempts to execute the content to read.

      Returns DoubleWord

      Doubleword-sized binary data.

      If the page the given virtual address is part of, is currently not associated with a page frame.

      If the page frame associated with this page is not accessable in user mode.

      If the page frame associated with this page is not executable.

      If the page frame associated with this page is not writable.

    • This method writes a specified byte of data to the specified address in in the main memory. Throws an error, if the data exeeds a byte.

      Parameters

      • virtualAddress: VirtualAddress

        A binary value representing a virtual memory address to write the data to.

      • data: Byte

        Byte-sized data to write to the specified pyhsical memory address.

      Returns void

      If the page the given virtual address is part of, is currently not associated with a page frame.

      If the page frame associated with this page is not accessable in user mode.

      If the page frame associated with this page is not executable.

      If the page frame associated with this page is not writable.

    • This methods writes a doubleword (4-byte) value to memory to the specified memory address.

      Parameters

      Returns void

      If the page the given virtual address is part of, is currently not associated with a page frame.

      If the page frame associated with this page is not accessable in user mode.

      If the page frame associated with this page is not executable.

      If the page frame associated with this page is not writable.