FreeNOS
Static Public Member Functions
MemoryBlock Class Reference

Memory block operations class. More...

#include <MemoryBlock.h>

Static Public Member Functions

static void * set (void *dest, int ch, unsigned count)
 Fill memory with a constant byte.
 
static Size copy (void *dest, const void *src, Size count)
 Copy memory from one place to another.
 
static Size copy (char *dest, char *src, Size count)
 Copy a character string.
 
static bool compare (const void *p1, const void *p2, const Size count)
 Compare memory.
 
static bool compare (const char *p1, const char *p2, const Size count=0)
 Compare memory.
 

Detailed Description

Memory block operations class.

Todo:
Add architecture specific implementations for extra speed. The alternative implementations should be placed in libarch without creating a new dependency in libstd, for example using weak symbols.

Definition at line 38 of file MemoryBlock.h.

Member Function Documentation

◆ compare() [1/2]

bool MemoryBlock::compare ( const char *  p1,
const char *  p2,
const Size  count = 0 
)
static

Compare memory.

Parameters
p1Memory pointer one.
p2Memory pointer two.
countNumber of bytes to compare or zero to continue until a ZERO byte.
Returns
True if equal, false otherwise.

Definition at line 93 of file MemoryBlock.cpp.

References ZERO.

◆ compare() [2/2]

bool MemoryBlock::compare ( const void *  p1,
const void *  p2,
const Size  count 
)
static

Compare memory.

Parameters
p1Memory pointer one.
p2Memory pointer two.
countNumber of bytes to compare
Returns
True if equal, false otherwise

Definition at line 77 of file MemoryBlock.cpp.

Referenced by MpiTarget::initialize(), MpiTarget::initializeMaster(), and DhcpClient::receiveBootResponse().

◆ copy() [1/2]

Size MemoryBlock::copy ( char *  dest,
char *  src,
Size  count 
)
static

Copy a character string.

Parameters
destDestination string.
srcSource string.
countNumber of bytes to copy.
Returns
Number of bytes copied

Definition at line 52 of file MemoryBlock.cpp.

◆ copy() [2/2]

Size MemoryBlock::copy ( void *  dest,
const void *  src,
Size  count 
)
static

Copy memory from one place to another.

Parameters
destDestination address.
srcSource address.
countNumber of bytes to copy.
Returns
Number of bytes copied.

Definition at line 41 of file MemoryBlock.cpp.

References sp.

Referenced by ARMException::ARMException(), IOBuffer::bufferedWrite(), ProcessShares::createShare(), Lz4Decompressor::decompress(), ARMProcess::execute(), ARM64Process::execute(), FileSystemRequest::FileSystemRequest(), FileSystemClient::findMount(), Ethernet::getAddress(), Loopback::getAddress(), Ethernet::getTransmitPacket(), DhcpClient::initialize(), Directory::insert(), RaspberryKernel::interrupt(), SunxiKernel::interrupt(), kernel_main(), Mount::listMounts(), Kernel::loadBootProgram(), ARP::lookupAddress(), FileSystemServer::mountHandler(), multibootToCoreInfo(), String::operator<<(), String::operator=(), String::operator=(), UDPSocket::process(), ICMP::process(), MpiProxy::processExec(), PseudoFile::PseudoFile(), BootImageStorage::read(), LinnDirectory::read(), Lz4Decompressor::read(), IOBuffer::read(), read16(), read32(), read64(), read8(), readBe16(), readBe32(), readBe64(), readLe16(), readLe32(), readLe64(), ProcessShares::readShare(), MpiHost::receivePacket(), DatastoreClient::registerBuffer(), FileSystemClient::request(), FileSystemClient::request(), String::resize(), RecoveryServer::rewriteProgram(), MpiHost::send(), DhcpClient::sendBootRequest(), ICMP::sendPacket(), ARP::sendReply(), ARP::sendRequest(), ChannelClient::sendRequest(), Ethernet::setAddress(), Loopback::setAddress(), ARMProcess::setCpuState(), ARM64Process::setCpuState(), ICMPSocket::setReply(), Process::sleep(), spawn(), MpiHost::startProcesses(), String::String(), String::String(), String::String(), SystemInfoHandler(), ARMKernel::trap(), ARM64Kernel::trap(), String::trim(), TestChar< T >::unique(), ARP::updateCacheEntry(), VMCopyHandler(), IOBuffer::write(), PseudoFile::write(), IPV4Address::write(), UDPSocket::write(), VGA::write(), write16(), write32(), write64(), write8(), writeBe16(), writeBe32(), writeBe64(), writeLe16(), writeLe32(), and writeLe64().

◆ set()

void * MemoryBlock::set ( void *  dest,
int  ch,
unsigned  count 
)
static

Fill memory with a constant byte.

Parameters
destMemory to write to.
chConstant byte.
countNumber of bytes to fill.
Returns
Pointer to dest.

Definition at line 30 of file MemoryBlock.cpp.

Referenced by Allocator::Allocator(), ARM64Map::ARM64Map(), ARMMap::ARMMap(), ARPSocket::ARPSocket(), BitArray::clear(), clearBSS(), CoreServer::clearPages(), CoreServer::CoreServer(), MpiProxy::createChannels(), ProcessShares::createShare(), DhcpClient::DhcpClient(), Ethernet::Ethernet(), NetSend::exec(), ICMPSocket::ICMPSocket(), Process::initialize(), ARMPaging::initialize(), ARM64Paging::initialize(), IntelPaging::initialize(), Kernel::initializeHeap(), MpiTarget::initializeMaster(), ARP::insertCacheEntry(), IntelKernel::IntelKernel(), IntelMap::IntelMap(), kernel_main(), Kernel::loadBootProgram(), BootSymbolStorage::loadSegment(), BootSymbolStorage::loadSymbol(), ARP::lookupAddress(), ARMFirstTable::map(), ARM64FirstTable::map(), IntelPageDirectory::map(), FileSystemServer::mount(), MpiProxy::MpiProxy(), MpiTarget::MpiTarget(), multibootToCoreInfo(), NetworkSocket::NetworkSocket(), String::pad(), PoolAllocator::PoolAllocator(), CoreServer::prepareCoreInfo(), Process::Process(), MpiProxy::processExec(), MpiProxy::processTerminate(), ARMProcess::reset(), ARM64Process::reset(), IntelProcess::reset(), MemoryChannel::reset(), RecoveryServer::rewriteProgram(), DhcpClient::sendBootRequest(), ARP::sendRequest(), setupMappings(), spawn(), TestChar< T >::unique(), CoreServer::unloadKernel(), Process::wakeup(), and PseudoFile::write().


The documentation for this class was generated from the following files: