using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace Cosmos.Kernel { public abstract class AddressSpace { public UInt32 Offset; public UInt32 Size; public AddressSpace( UInt32 offset, UInt32 size ) { Offset = offset; Size = size; } /// /// Reads 8 bits from a given offset if it within the valid range /// /// The offset to read from /// 8 bits of data read public abstract byte Read8( UInt32 offset ); /// /// Reads 16 bits from a given offset if it within the valid range /// /// The offset to read from /// 16 bits of data read public abstract UInt16 Read16( UInt32 offset ); /// /// Reads 32 bits from a given offset if it within the valid range /// /// The offset to read from /// 32 bits of data read public abstract UInt32 Read32( UInt32 offset ); /// /// Reads 64 bits from a given offset if it within the valid range /// /// The offset to read from /// 32 bits of data read public abstract UInt64 Read64( UInt32 offset ); /// /// Reads 8 bits from a given offset. The offset is not checked. Use with caution /// /// The offset to read from /// 8 bits of data read public abstract byte Read8Unchecked( UInt32 offset ); /// /// Reads 16 bits from a given offset. The offset is not checked. Use with caution /// /// The offset to read from /// 16 bits of data read public abstract UInt16 Read16Unchecked( UInt32 offset ); /// /// Reads 32 bits from a given offset. The offset is not checked. Use with caution /// /// The offset to read from /// 32 bits of data read public abstract UInt32 Read32Unchecked( UInt32 offset ); /// /// Reads 64 bits from a given offset. The offset is not checked. Use with caution /// /// The offset to read from /// 64 bits of data read public abstract UInt64 Read64Unchecked( UInt32 offset ); /// /// Writes 8 bits from a given offset if it is within the valid range. /// /// The offset to write to /// The data to write public abstract void Write8( UInt32 offset, byte value ); /// /// Writes 16 bits from a given offset if it is within the valid range. /// /// The offset to write to /// The data to write public abstract void Write16( UInt32 offset, UInt16 value ); /// /// Writes 32 bits from a given offset if it is within the valid range. /// /// The offset to write to /// The data to write public abstract void Write32( UInt32 offset, UInt32 value ); /// /// Writes 64 bits from a given offset if it is within the valid range. /// /// The offset to write to /// The data to write public abstract void Write64( UInt32 offset, UInt64 value ); /// /// Writes 8 bits from a given offset. The offset is not checked. Use with caution. /// /// The offset to write to /// The data to write public abstract void Write8Unchecked( UInt32 offset, byte value ); /// /// Writes 16 bits from a given offset. The offset is not checked. Use with caution. /// /// The offset to write to /// The data to write public abstract void Write16Unchecked( UInt32 offset, UInt16 value ); /// /// Writes 32 bits from a given offset. The offset is not checked. Use with caution. /// /// The offset to write to /// The data to write public abstract void Write32Unchecked( UInt32 offset, UInt32 value ); /// /// Writes 64 bits from a given offset. The offset is not checked. Use with caution. /// /// The offset to write to /// The data to write public abstract void Write64Unchecked( UInt32 offset, UInt64 value ); } }