• Home
  • Install
  • Cosmos Website
  • Articles
  • Cosmos
  • X#
  • IL2CPU
Show / Hide Table of Contents
  • Cosmos.Core
    • ACPI
    • ACPI.RSDPtr
    • Bootstrap
    • CPU
    • GCImplementation
    • GCTable
    • Global
    • INTs
    • INTs.EFlagsEnum
    • INTs.ExceptionInterruptDelegate
    • INTs.IRQContext
    • INTs.IRQDelegate
    • INTs.MMXContext
    • INTs.TSS
    • IOPort
    • KernelPanics
    • ManagedMemoryBlock
    • MemoryBlock
    • MemoryBlock08
    • MemoryBlock16
    • MemoryBlock32
    • MemoryMapBlock
    • MemoryOperations
    • PIC
    • PIC.Cmd
    • RawMemoryMapBlock
    • VTable
    • VTablesImpl
  • Cosmos.Core.IOGroup
    • ATA
    • PIC
    • PS2Controller
  • Cosmos.Core.Memory
    • Heap
    • HeapLarge
    • HeapMedium
    • HeapSmall
    • ObjectGCStatus
    • RAT
    • RAT.PageType
    • RootSMTBlock
    • SMTBlock
    • SMTPage
  • Cosmos.Core.MemoryGroup
    • AHCI
  • Cosmos.Core.Multiboot
    • Multiboot2
  • Cosmos.Core.Multiboot.Tags
    • AcpiNew
    • AcpiOld
    • BasicMemoryInformation
    • EFI64
    • Framebuffer
    • MB2Tag
    • MemoryMap
  • Cosmos.Core_Asm
    • ArrayClearAsm
    • ArrayGetLengthAsm
    • ArrayImpl
    • ArrayInternalCopyAsm
    • BufferBlockCopyAsm
    • BufferImpl
    • CPUCanReadCPUIDAsm
    • CPUDisableINTsAsm
    • CPUEnableINTsAsm
    • CPUGetEBPValue
    • CPUGetEndOfKernelAsm
    • CPUGetESPValue
    • CPUGetStackStart
    • CPUHaltAsm
    • CPUImpl
    • CPUInitFloatAsm
    • CPUInitSSEAsm
    • CPUReadCPUIDAsm
    • CPUReadModelSpecificRegisterAsm
    • CPUReadTimestampCounterAsm
    • CPUSetESPValue
    • CPUUpdateIDTAsm
    • CPUZeroFillAsm
    • DelegateCtorAsm
    • DelegateGetMulticastInvokeAsm
    • DelegateImpl
    • DelegateInvokeAsm
    • GCImplementationImpl
    • IOPortImpl
    • Multiboot2Impl
    • Multiboot2ImplAsm
    • RuntimeHelpersImpl
  • Cosmos.Core_Asm.MemoryOperations
    • MemoryOperationsCopy128BlocksAsm
    • MemoryOperationsCopy128BytesAsm
    • MemoryOperationsCopy16BytesAsm
    • MemoryOperationsCopy32BytesAsm
    • MemoryOperationsCopy64BytesAsm
    • MemoryOperationsFill16BlocksAsm
  • Cosmos.Debug.Kernel
    • Debugger
    • DebuggerFactory
  • Cosmos.HAL
    • BaudRate
    • Bootstrap
    • CardType
    • ClassID
    • COMPort
    • DataReceivedHandler
    • Device
    • DeviceID
    • Global
    • KeyboardBase
    • KeyboardBase.KeyPressedEventHandler
    • MouseBase
    • MouseBase.MouseChangedEventHandler
    • NetworkDevice
    • PCI
    • PCIBaseAddressBar
    • PCIDevice
    • PCIDevice.Config
    • PCIDevice.DeviceClass
    • PCIDevice.PCIBist
    • PCIDevice.PCICommand
    • PCIDevice.PCIHeaderType
    • PCIDevice.PCIInterruptPIN
    • PCIDeviceBridge
    • PCIDeviceCardbus
    • PCIDeviceNormal
    • PCSpeaker
    • PIT
    • PIT.PITTimer
    • PIT.PITTimer.OnTrigger
    • Power
    • ProgramIF
    • PS2Controller
    • PS2Keyboard
    • PS2Mouse
    • RTC
    • SerialPort
    • SpeakerExtensions
    • SubclassID
    • TextScreen
    • TextScreenBase
    • TextScreenHelpers
    • VendorID
  • Cosmos.HAL.Audio
    • AudioBitDepth
    • AudioBuffer
    • IAudioBufferProvider
    • SampleFormat
  • Cosmos.HAL.BlockDevice
    • AHCI
    • Ata
    • Ata.BusPositionEnum
    • Ata.ControllerIdEnum
    • ATA_PIO
    • ATA_PIO.Cmd
    • ATA_PIO.DvcSelVal
    • ATA_PIO.Ident
    • ATA_PIO.SpecLevel
    • ATA_PIO.Status
    • ATAPI
    • ATAPI.PacketCommands
    • BlockDevice
    • BlockDeviceType
    • EBR
    • EBR.PartInfo
    • GPT
    • GPT.GPartInfo
    • IDE
    • MBR
    • MBR.PartInfo
    • Partition
  • Cosmos.HAL.BlockDevice.Ports
    • SATA
    • SATAPI
    • StoragePort
  • Cosmos.HAL.BlockDevice.Registers
    • AHCISignature
    • ATACommands
    • ATADeviceStatus
    • Base
    • Bases
    • CommandAndStatus
    • CurrentInterfaceSpeedStatus
    • DeviceDetectionStatus
    • FISRegisterD2H
    • FISRegisterH2D
    • FISSize
    • FISType
    • GenericRegisters
    • HBACommandHeader
    • HBACommandTable
    • HBAPRDTEntry
    • InterfacePowerManagementStatus
    • InterruptEnable
    • InterruptStatus
    • PortRegisters
    • PortType
  • Cosmos.HAL.Drivers.Audio
    • AC97
    • AudioDriver
  • Cosmos.HAL.Drivers.Network
    • AMDPCNetII
    • E1000
    • E1000.RXDesc
    • E1000.TXDesc
    • E1000DeviceID
    • RTL8139
  • Cosmos.HAL.Drivers.USB
    • USBHost
  • Cosmos.HAL.Drivers.Video
    • VBEDriver
    • VGADriver
    • VGADriver.ColorDepth
    • VGADriver.ScreenSize
    • VGADriver.TextSize
  • Cosmos.HAL.Drivers.Video.SVGAII
    • Capability
    • FIFO
    • FIFOCommand
    • ID
    • IOPortOffset
    • Register
    • VMWareSVGAII
  • Cosmos.HAL.Network
    • MACAddress
    • NetworkInit
  • Cosmos.System
    • Console
    • ConsoleKeyEx
    • ConsoleKeyExExtensions
    • Durations
    • Global
    • Kernel
    • KeyboardManager
    • KeyEvent
    • KeyEvent.KeyEventType
    • KeyMapping
    • MouseManager
    • MouseState
    • Notes
    • PCSExtensions
    • PCSpeaker
    • Power
    • ScanMapBase
    • VMTools
  • Cosmos.System.Audio
    • AudioManager
    • AudioMixer
    • AudioStream
  • Cosmos.System.Audio.DSP.Processing
    • AudioPostProcessor
    • GainPostProcessor
  • Cosmos.System.Audio.IO
    • AudioBufferReader
    • AudioBufferReadWriteBase
    • AudioBufferWriter
    • MemoryAudioStream
    • SeekableAudioStream
  • Cosmos.System.ExtendedASCII
    • CosmosEncodingProvider
  • Cosmos.System.FileSystem
    • CosmosVFS
    • Disk
    • FileSystem
    • FileSystemFactory
    • ManagedPartition
  • Cosmos.System.FileSystem.FAT
    • FatFileSystemFactory
  • Cosmos.System.FileSystem.FAT.Listing
    • FatDirectoryEntryAttributeConsts
    • FatDirectoryEntryMetadata
    • FatDirectoryEntryMetadata.LongFilenameEntryMetadata
  • Cosmos.System.FileSystem.ISO9660
    • ISO9660FileSystem
    • ISO9660FileSystemFactory
  • Cosmos.System.FileSystem.Listing
    • DirectoryEntry
    • DirectoryEntryTypeEnum
  • Cosmos.System.FileSystem.VFS
    • FileSystemManager
    • VFSBase
    • VFSManager
  • Cosmos.System.Graphics
    • Bitmap
    • Canvas
    • ColorDepth
    • ColorOrder
    • FullScreenCanvas
    • Image
    • ImageFormat
    • Mode
    • SVGAIICanvas
    • VBECanvas
    • VGACanvas
    • VGAScreen
  • Cosmos.System.Graphics.Fonts
    • Font
    • PCScreenFont
    • UnicodeMapping
  • Cosmos.System.Helpers
    • ArrayHelper
  • Cosmos.System.IO
    • ConsoleStream
    • SyncTextReader
  • Cosmos.System.Keyboard
    • KeyEventHelper
  • Cosmos.System.Network
    • EthernetPacket
    • NetworkDebugger
    • NetworkStack
  • Cosmos.System.Network.ARP
    • ARPPacket
  • Cosmos.System.Network.Config
    • DNSConfig
    • IPConfig
    • NetworkConfig
    • NetworkConfiguration
  • Cosmos.System.Network.IPv4
    • Address
    • EndPoint
    • ICMPClient
    • ICMPPacket
    • IPPacket
    • OutgoingBuffer
  • Cosmos.System.Network.IPv4.TCP
    • Flags
    • Status
    • Tcp
    • TCPOption
    • TCPPacket
    • TransmissionControlBlock
  • Cosmos.System.Network.IPv4.UDP
    • UdpClient
    • UDPPacket
  • Cosmos.System.Network.IPv4.UDP.DHCP
    • DHCPClient
    • DHCPOption
    • DHCPPacket
  • Cosmos.System.Network.IPv4.UDP.DNS
    • DNSAnswer
    • DnsClient
    • DNSPacket
    • DNSPacketAnswer
    • DNSPacketAsk
    • DNSQuery
    • ReplyCode
  • Cosmos.System.ScanMaps
    • DEStandardLayout
    • ESStandardLayout
    • FRStandardLayout
    • GBStandardLayout
    • TRStandardLayout
    • US_Dvorak
    • USStandardLayout

Class MemoryBlock

MemoryBlock class. Used to read and write to memory blocks.

Inheritance
System.Object
MemoryBlock
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Cosmos.Core
Assembly: Cosmos.Core.dll
Syntax
public class MemoryBlock

Constructors

| Improve this Doc View Source

MemoryBlock(UInt32, UInt32)

Create new instance of the MemoryBlock class.

Declaration
public MemoryBlock(uint aBase, uint aByteSize)
Parameters
Type Name Description
System.UInt32 aBase

A base.

System.UInt32 aByteSize

A size.

Fields

| Improve this Doc View Source

Base

Memory block base address.

Declaration
public readonly uint Base
Field Value
Type Description
System.UInt32
| Improve this Doc View Source

Bytes

Bytes memory block.

Declaration
public readonly MemoryBlock08 Bytes
Field Value
Type Description
MemoryBlock08
| Improve this Doc View Source

DWords

DWords memory block.

Declaration
public readonly MemoryBlock32 DWords
Field Value
Type Description
MemoryBlock32
| Improve this Doc View Source

Size

Memory block size.

Declaration
public readonly uint Size
Field Value
Type Description
System.UInt32
| Improve this Doc View Source

Words

Words memory block.

Declaration
public readonly MemoryBlock16 Words
Field Value
Type Description
MemoryBlock16

Properties

| Improve this Doc View Source

Item[UInt32]

Get and set memory block.

Declaration
public uint this[uint aByteOffset] { get; set; }
Parameters
Type Name Description
System.UInt32 aByteOffset

A byte offset.

Property Value
Type Description
System.UInt32

uint value.

Exceptions
Type Condition
System.Exception

Thrown on memory access violation.

Methods

| Improve this Doc View Source

Copy(ManagedMemoryBlock)

Copy ManagedMemoryBlock into MemoryBlock

Declaration
public void Copy(ManagedMemoryBlock block)
Parameters
Type Name Description
ManagedMemoryBlock block

ManagedMemoryBlock to copy.

| Improve this Doc View Source

Copy(Byte[])

Copy data from the buffer to the start of the memory block.

Declaration
public void Copy(byte[] aData)
Parameters
Type Name Description
System.Byte[] aData

A data buffer array.

Exceptions
Type Condition
System.OverflowException

Thrown if aData length in greater then Int32.MaxValue.

| Improve this Doc View Source

Copy(Int32, Byte[], Int32, Int32)

Copy data from the buffer array to the memory block.

Declaration
public void Copy(int aByteOffset, byte[] aData, int aIndex, int aCount)
Parameters
Type Name Description
System.Int32 aByteOffset

Starting point offset in bytes

System.Byte[] aData

A data buffer array.

System.Int32 aIndex

A staring index in the source data buffer array.

System.Int32 aCount

Number of bytes to copy.

| Improve this Doc View Source

Copy(Int32, Int32[], Int32, Int32)

Copy data from the buffer array to the memory block.

Declaration
public void Copy(int aByteOffset, int[] aData, int aIndex, int aCount)
Parameters
Type Name Description
System.Int32 aByteOffset

Starting point offset in bytes

System.Int32[] aData

A data buffer array.

System.Int32 aIndex

A staring index in the source data buffer array.

System.Int32 aCount

Number of integers to copy.

| Improve this Doc View Source

Copy(Int32[])

Copy data from the buffer to the start of the memory block.

Declaration
public void Copy(int[] aData)
Parameters
Type Name Description
System.Int32[] aData

A data buffer array.

Exceptions
Type Condition
System.OverflowException

Thrown if aData length in greater then Int32.MaxValue.

| Improve this Doc View Source

Copy(Int32[], Int32, Int32)

Copy data from the buffer array to the start of the memory block.

Declaration
public void Copy(int[] aData, int aIndex, int aCount)
Parameters
Type Name Description
System.Int32[] aData

A data buffer array.

System.Int32 aIndex

A staring index in the source data buffer array.

System.Int32 aCount

Number of integers to copy.

Exceptions
Type Condition
System.OverflowException

Thrown if aData length in greater then Int32.MaxValue.

| Improve this Doc View Source

Copy(UInt32, UInt32[], Int32, Int32)

Copy data from the buffer array to the memory block.

Declaration
public void Copy(uint aByteOffset, uint[] aData, int aIndex, int aCount)
Parameters
Type Name Description
System.UInt32 aByteOffset

Starting point offset in bytes

System.UInt32[] aData

A data buffer array.

System.Int32 aIndex

A staring index in the source data buffer array.

System.Int32 aCount

Number of bytes to copy.

| Improve this Doc View Source

Copy(UInt32[])

Copy data from the buffer to the start of the memory block.

Declaration
public void Copy(uint[] aData)
Parameters
Type Name Description
System.UInt32[] aData

A data buffer array.

Exceptions
Type Condition
System.OverflowException

Thrown if aData length in greater then Int32.MaxValue.

| Improve this Doc View Source

Fill(Byte)

Fill data to memory block.

Declaration
public void Fill(byte aData)
Parameters
Type Name Description
System.Byte aData

Data to fill the memory block with.

| Improve this Doc View Source

Fill(Int32, Int32, Int32)

Fill memory block with a value. The filling is integer aligned

Declaration
public void Fill(int aByteOffset, int aCount, int aData)
Parameters
Type Name Description
System.Int32 aByteOffset

Byte offset from Base

System.Int32 aCount

Number of integers to fill

System.Int32 aData

Value to fill memory block with

| Improve this Doc View Source

Fill(UInt16)

Fill data to memory block.

Declaration
public void Fill(ushort aData)
Parameters
Type Name Description
System.UInt16 aData

Data to fill the memory block with.

| Improve this Doc View Source

Fill(UInt32)

Fill memory block.

Declaration
public void Fill(uint aData)
Parameters
Type Name Description
System.UInt32 aData

A data to fill.

| Improve this Doc View Source

Fill(UInt32, UInt32, Byte)

Fill data to memory block.

Declaration
public void Fill(uint aByteOffset, uint aCount, byte aData)
Parameters
Type Name Description
System.UInt32 aByteOffset

Starting point offset in bytes

System.UInt32 aCount

Data size.

System.Byte aData

A data to fill memory block with.

| Improve this Doc View Source

Fill(UInt32, UInt32, UInt16)

Fill data to memory block.

Declaration
public void Fill(uint aByteOffset, uint aCount, ushort aData)
Parameters
Type Name Description
System.UInt32 aByteOffset

Starting point offset in bytes

System.UInt32 aCount

Data size.

System.UInt16 aData

A data to fill memory block with.

| Improve this Doc View Source

Fill(UInt32, UInt32, UInt32)

Fill memory block.

Declaration
public void Fill(uint aByteOffset, uint aCount, uint aData)
Parameters
Type Name Description
System.UInt32 aByteOffset

A start.

System.UInt32 aCount

A count.

System.UInt32 aData

A data.

| Improve this Doc View Source

Get(Int32, Byte[], Int32, Int32)

Copies a specified number of bytes from the memory block into an array.

Declaration
public void Get(int aByteOffset, byte[] aData, int aIndex, int aCount)
Parameters
Type Name Description
System.Int32 aByteOffset

The byte offset in the memory block from where the copy starts.

System.Byte[] aData

The array where the data will be copied to.

System.Int32 aIndex

The starting index in the destination array.

System.Int32 aCount

The number of bytes to copy.

| Improve this Doc View Source

Get(Int32, Int32[], Int32, Int32)

Copies data from the memory block to the specified array.

Declaration
public void Get(int aByteOffset, int[] aData, int aIndex, int aCount)
Parameters
Type Name Description
System.Int32 aByteOffset

The byte offset in the memory block from which to start copying.

System.Int32[] aData

The array into which data will be copied.

System.Int32 aIndex

The starting index in the array where data will be copied.

System.Int32 aCount

The number of elements to copy.

| Improve this Doc View Source

MoveDown(UInt32, UInt32, UInt32)

Move bytes array down the memory block.

Declaration
public void MoveDown(uint aDest, uint aSrc, uint aCount)
Parameters
Type Name Description
System.UInt32 aDest

Destination location.

System.UInt32 aSrc

Sourcs location.

System.UInt32 aCount

Number of bytes to move.

| Improve this Doc View Source

MoveUp(UInt32, UInt32, UInt32)

Move data inside the block. Undone.

Declaration
public void MoveUp(uint aDest, uint aSrc, uint aCount)
Parameters
Type Name Description
System.UInt32 aDest

A destination address.

System.UInt32 aSrc

A source address.

System.UInt32 aCount

Number of bytes to move.

Remarks

Always throw. Yet to be done.

Exceptions
Type Condition
System.Exception

Thrown always.

| Improve this Doc View Source

Read16(UInt16[])

Read 16-bit from the memory block.

Declaration
public void Read16(ushort[] aBuffer)
Parameters
Type Name Description
System.UInt16[] aBuffer

A buffer to write the data to.

Exceptions
Type Condition
System.OverflowException

Thrown if aBuffer length in greater then Int32.MaxValue.

System.Exception

Thrown on memory access violation.

| Improve this Doc View Source

Read32(UInt32[])

Read 32-bit from the memory block.

Declaration
public void Read32(uint[] aBuffer)
Parameters
Type Name Description
System.UInt32[] aBuffer

A buffer to write the data to.

Exceptions
Type Condition
System.OverflowException

Thrown if aBuffer length in greater then Int32.MaxValue.

System.Exception

Thrown on memory access violation.

| Improve this Doc View Source

Read8(Byte[])

Read 8-bit from the memory block.

Declaration
public void Read8(byte[] aBuffer)
Parameters
Type Name Description
System.Byte[] aBuffer

A buffer to write the data to.

Exceptions
Type Condition
System.OverflowException

Thrown if aBuffer length in greater then Int32.MaxValue.

System.Exception

Thrown on memory access violation.

| Improve this Doc View Source

ToArray()

Convert the memory block to array.

Declaration
public uint[] ToArray()
Returns
Type Description
System.UInt32[]

uint array.

| Improve this Doc View Source

ToArray(Int32, Int32, Int32)

Convert part for the memory block to array.

Declaration
public uint[] ToArray(int aStart, int aIndex, int aCount)
Parameters
Type Name Description
System.Int32 aStart

A starting position of the data at the source memory block.

System.Int32 aIndex

A index to be the staring index at the destination array.

System.Int32 aCount

Number of bytes to get.

Returns
Type Description
System.UInt32[]

uint array.

| Improve this Doc View Source

Write16(UInt16[])

Write 16-bit to the memory block.

Declaration
public void Write16(ushort[] aBuffer)
Parameters
Type Name Description
System.UInt16[] aBuffer

A buffer to be written to the memory block.

Exceptions
Type Condition
System.OverflowException

Thrown if aBuffer length in greater then Int32.MaxValue.

System.Exception

Thrown on memory access violation.

| Improve this Doc View Source

Write32(UInt32[])

Write 32-bit to the memory block.

Declaration
public void Write32(uint[] aBuffer)
Parameters
Type Name Description
System.UInt32[] aBuffer

A buffer to be written to the memory block.

Exceptions
Type Condition
System.OverflowException

Thrown if aBuffer length in greater then Int32.MaxValue.

System.Exception

Thrown on memory access violation.

| Improve this Doc View Source

Write8(Byte[])

Write 8-bit to the memory block.

Declaration
public void Write8(byte[] aBuffer)
Parameters
Type Name Description
System.Byte[] aBuffer

A buffer to be written to the memory block.

Exceptions
Type Condition
System.OverflowException

Thrown if aBuffer length in greater then Int32.MaxValue.

System.Exception

Thrown on memory access violation.

  • Improve this Doc
  • View Source
☀
☾
In This Article
Back to top
☀
☾