Replace <libmaxsi/memory.h> with <string.h>.

This commit is contained in:
Jonas 'Sortie' Termansen 2012-09-22 20:38:34 +02:00
parent 5d082b3bbb
commit b4374f66b7
43 changed files with 112 additions and 184 deletions

View File

@ -24,7 +24,6 @@
#include <sys/mman.h> #include <sys/mman.h>
#include <libmaxsi/platform.h> #include <libmaxsi/platform.h>
#include <libmaxsi/memory.h>
#ifdef SORTIX_KERNEL #ifdef SORTIX_KERNEL
#define HEAP_GROWS_DOWNWARDS #define HEAP_GROWS_DOWNWARDS
@ -39,6 +38,7 @@
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <malloc.h> #include <malloc.h>
#include <string.h>
#define PARANOIA 1 #define PARANOIA 1
@ -703,7 +703,7 @@ namespace Maxsi
size_t total = nmemb * size; size_t total = nmemb * size;
void* result = Allocate(total); void* result = Allocate(total);
if ( !result ) { return NULL; } if ( !result ) { return NULL; }
Memory::Set(result, 0, total); memset(result, 0, total);
return result; return result;
} }
@ -718,7 +718,7 @@ namespace Maxsi
if ( size < allocsize ) { return ptr; } if ( size < allocsize ) { return ptr; }
void* newptr = Allocate(size); void* newptr = Allocate(size);
if ( !newptr ) { return NULL; } if ( !newptr ) { return NULL; }
Memory::Copy(newptr, ptr, allocsize); memcpy(newptr, ptr, allocsize);
Free(ptr); Free(ptr);
return newptr; return newptr;
} }

View File

@ -1,50 +0,0 @@
/******************************************************************************
COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011.
This file is part of LibMaxsi.
LibMaxsi is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option)
any later version.
LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License
along with LibMaxsi. If not, see <http://www.gnu.org/licenses/>.
memory.h
Useful functions for manipulating memory, as well as the implementation
of the heap.
******************************************************************************/
#ifndef LIBMAXSI_MEMORY_H
#define LIBMAXSI_MEMORY_H
namespace Maxsi
{
namespace Memory
{
void Init();
void* Allocate(size_t Size);
void Free(void* Addr);
size_t GetChunkOverhead();
void* Copy(void* Dest, const void* Src, size_t Length);
void* Set(void* Dest, int Value, size_t Length);
int Compare(const void* a, const void* b, size_t size);
}
}
// Placement new.
inline void* operator new(size_t, void* p) { return p; }
inline void* operator new[](size_t, void* p) { return p; }
inline void operator delete (void*, void*) { };
inline void operator delete[](void*, void*) { };
#endif

View File

@ -24,7 +24,7 @@
*******************************************************************************/ *******************************************************************************/
#include <libmaxsi/platform.h> #include <libmaxsi/platform.h>
#include <libmaxsi/memory.h> #include <malloc.h>
#include <string.h> #include <string.h>
namespace Maxsi namespace Maxsi
@ -48,7 +48,7 @@ namespace Maxsi
init_signal(); init_signal();
// Initialize the dynamic heap. // Initialize the dynamic heap.
Memory::Init(); _init_heap();
// Initialize stdio. // Initialize stdio.
init_stdio(); init_stdio();

View File

@ -23,10 +23,10 @@
******************************************************************************/ ******************************************************************************/
#include <libmaxsi/platform.h> #include <libmaxsi/platform.h>
#include <libmaxsi/memory.h>
#ifndef SORTIX_KERNEL #ifndef SORTIX_KERNEL
#include <sys/syscall.h> #include <sys/syscall.h>
#endif #endif
#include <string.h>
namespace Maxsi namespace Maxsi
{ {
@ -58,8 +58,8 @@ namespace Maxsi
uint8_t* dest = (uint8_t*) _dest; uint8_t* dest = (uint8_t*) _dest;
const uint8_t* src = (const uint8_t*) _src; const uint8_t* src = (const uint8_t*) _src;
uint8_t* tmp = new uint8_t[n]; uint8_t* tmp = new uint8_t[n];
Memory::Copy(tmp, src, n); memcpy(tmp, src, n);
Memory::Copy(dest, tmp, n); memcpy(dest, tmp, n);
delete[] tmp; delete[] tmp;
return _dest; return _dest;
} }

View File

@ -23,12 +23,12 @@
*******************************************************************************/ *******************************************************************************/
#include <libmaxsi/platform.h> #include <libmaxsi/platform.h>
#include <libmaxsi/memory.h>
#include <libmaxsi/process.h> #include <libmaxsi/process.h>
#include <sys/syscall.h> #include <sys/syscall.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>
#include <string.h>
namespace Maxsi namespace Maxsi
{ {

View File

@ -24,7 +24,6 @@
#include <libmaxsi/platform.h> #include <libmaxsi/platform.h>
#include <libmaxsi/string.h> #include <libmaxsi/string.h>
#include <libmaxsi/memory.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
@ -196,7 +195,7 @@ namespace Maxsi
size_t InputSize = Length(Input); size_t InputSize = Length(Input);
char* Result = new char[InputSize + 1]; char* Result = new char[InputSize + 1];
if ( Result == NULL ) { return NULL; } if ( Result == NULL ) { return NULL; }
Memory::Copy(Result, Input, InputSize + 1); memcpy(Result, Input, InputSize + 1);
return Result; return Result;
} }
@ -205,7 +204,7 @@ namespace Maxsi
size_t srclen = Length(src); size_t srclen = Length(src);
char* dest = new char[length + 1]; char* dest = new char[length + 1];
if ( !dest ) { return NULL; } if ( !dest ) { return NULL; }
Memory::Copy(dest, src + offset, length * sizeof(char)); memcpy(dest, src + offset, length * sizeof(char));
dest[length] = 0; dest[length] = 0;
return dest; return dest;
} }

View File

@ -23,7 +23,6 @@
*******************************************************************************/ *******************************************************************************/
#include <libmaxsi/platform.h> #include <libmaxsi/platform.h>
#include <libmaxsi/memory.h>
#include <sys/syscall.h> #include <sys/syscall.h>
#include <errno.h> #include <errno.h>
#include <sys/time.h> #include <sys/time.h>

View File

@ -25,8 +25,8 @@
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <sortix/kernel/kthread.h> #include <sortix/kernel/kthread.h>
#include "cpu.h" #include "cpu.h"
#include <libmaxsi/memory.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include "ata.h" #include "ata.h"
#include "fs/devfs.h" #include "fs/devfs.h"
@ -311,7 +311,7 @@ namespace Sortix
if ( numbytes < wanted ) { wanted = numbytes; } if ( numbytes < wanted ) { wanted = numbytes; }
uint8_t temp[512 /*sectorsize*/]; uint8_t temp[512 /*sectorsize*/];
if ( !ReadSector(byteoffset/sectorsize, temp) ) { return sofar; } if ( !ReadSector(byteoffset/sectorsize, temp) ) { return sofar; }
Memory::Copy(dest + sofar, temp + leadingbytes, wanted); memcpy(dest + sofar, temp + leadingbytes, wanted);
sofar += wanted; sofar += wanted;
numbytes -= wanted; numbytes -= wanted;
byteoffset += wanted; byteoffset += wanted;
@ -339,7 +339,7 @@ namespace Sortix
if ( numbytes < wanted ) { wanted = numbytes; } if ( numbytes < wanted ) { wanted = numbytes; }
uint8_t temp[512 /*sectorsize*/]; uint8_t temp[512 /*sectorsize*/];
if ( !ReadSector(byteoffset/sectorsize, temp) ) { return sofar; } if ( !ReadSector(byteoffset/sectorsize, temp) ) { return sofar; }
Memory::Copy(temp + leadingbytes, src + sofar, wanted); memcpy(temp + leadingbytes, src + sofar, wanted);
if ( !WriteSector(byteoffset/sectorsize, temp) ) { return sofar; } if ( !WriteSector(byteoffset/sectorsize, temp) ) { return sofar; }
sofar += wanted; sofar += wanted;
numbytes -= wanted; numbytes -= wanted;

View File

@ -29,9 +29,9 @@
#include <sortix/kernel/memorymanagement.h> #include <sortix/kernel/memorymanagement.h>
#include <sortix/kernel/pci.h> #include <sortix/kernel/pci.h>
#include <sortix/mman.h> #include <sortix/mman.h>
#include <libmaxsi/memory.h>
#include <libmaxsi/string.h> #include <libmaxsi/string.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include "x86-family/memorymanagement.h" #include "x86-family/memorymanagement.h"
#include "lfbtextbuffer.h" #include "lfbtextbuffer.h"
#include "cpu.h" #include "cpu.h"
@ -85,14 +85,14 @@ addr_t DetectBGAFramebuffer()
pcifind_t pcifind; pcifind_t pcifind;
// Search for the bochs BGA device and compatible. // Search for the bochs BGA device and compatible.
Maxsi::Memory::Set(&pcifind, 255, sizeof(pcifind)); memset(&pcifind, 255, sizeof(pcifind));
pcifind.vendorid = 0x1234; pcifind.vendorid = 0x1234;
pcifind.deviceid = 0x1111; pcifind.deviceid = 0x1111;
if ( (devaddr = PCI::SearchForDevice(pcifind)) ) if ( (devaddr = PCI::SearchForDevice(pcifind)) )
return PCI::ParseDevBar0(devaddr); return PCI::ParseDevBar0(devaddr);
// Search for a generic VGA compatible device. // Search for a generic VGA compatible device.
Maxsi::Memory::Set(&pcifind, 255, sizeof(pcifind)); memset(&pcifind, 255, sizeof(pcifind));
pcifind.classid = 0x03; pcifind.classid = 0x03;
pcifind.subclassid = 0x00; pcifind.subclassid = 0x00;
pcifind.progif = 0x00; pcifind.progif = 0x00;
@ -381,7 +381,7 @@ ssize_t BGADriver::WriteAt(off_t off, const void* buf, size_t count)
return 0; return 0;
if ( framesize < off + count ) if ( framesize < off + count )
count = framesize - off; count = framesize - off;
Maxsi::Memory::Copy(frame + off, buf, count); memcpy(frame + off, buf, count);
return count; return count;
} }
@ -392,7 +392,7 @@ ssize_t BGADriver::ReadAt(off_t off, void* buf, size_t count)
return 0; return 0;
if ( framesize < off + count ) if ( framesize < off + count )
count = framesize - off; count = framesize - off;
Maxsi::Memory::Copy(buf, frame + off, count); memcpy(buf, frame + off, count);
return count; return count;
} }
@ -411,7 +411,7 @@ bool BGADriver::DetectModes() const
} }
modes = new char*[nummodes]; modes = new char*[nummodes];
if ( !modes ) { return false; } if ( !modes ) { return false; }
Maxsi::Memory::Set(modes, 0, sizeof(char*) * nummodes); memset(modes, 0, sizeof(char*) * nummodes);
size_t curmodeid = 0; size_t curmodeid = 0;
for ( unsigned w = 0; w < maxxres; w += 4U ) for ( unsigned w = 0; w < maxxres; w += 4U )
{ {

View File

@ -23,14 +23,12 @@
*******************************************************************************/ *******************************************************************************/
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <libmaxsi/memory.h>
#include <assert.h> #include <assert.h>
#include <string.h>
#include "descriptors.h" #include "descriptors.h"
#include "device.h" #include "device.h"
#include <sortix/fcntl.h> #include <sortix/fcntl.h>
using namespace Maxsi;
namespace Sortix namespace Sortix
{ {
// When in doubt use brute-force. This class could easily be optimized. // When in doubt use brute-force. This class could easily be optimized.
@ -84,11 +82,11 @@ namespace Sortix
if ( devices != NULL ) if ( devices != NULL )
{ {
Memory::Copy(newlist, devices, sizeof(*devices) * numdevices); memcpy(newlist, devices, sizeof(*devices) * numdevices);
} }
size_t numpadded = newlistlength-numdevices; size_t numpadded = newlistlength-numdevices;
Memory::Set(newlist + numdevices, 0, sizeof(*devices) * numpadded); memset(newlist + numdevices, 0, sizeof(*devices) * numpadded);
delete[] devices; delete[] devices;

View File

@ -24,7 +24,7 @@
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <sortix/kernel/kthread.h> #include <sortix/kernel/kthread.h>
#include <libmaxsi/memory.h> #include <string.h>
#include "device.h" #include "device.h"
namespace Sortix namespace Sortix

View File

@ -23,10 +23,10 @@
******************************************************************************/ ******************************************************************************/
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <libmaxsi/memory.h>
#include <libmaxsi/string.h> #include <libmaxsi/string.h>
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include "syscall.h" #include "syscall.h"
#include "process.h" #include "process.h"
#include "device.h" #include "device.h"

View File

@ -24,9 +24,9 @@
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <sortix/mman.h> #include <sortix/mman.h>
#include <libmaxsi/memory.h>
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include "elf.h" #include "elf.h"
#include <sortix/kernel/memorymanagement.h> #include <sortix/kernel/memorymanagement.h>
#include <sortix/kernel/panic.h> #include <sortix/kernel/panic.h>
@ -132,8 +132,8 @@ namespace Sortix
// Copy as much data as possible and memset the rest to 0. // Copy as much data as possible and memset the rest to 0.
uint8_t* memdest = (uint8_t*) virtualaddr; uint8_t* memdest = (uint8_t*) virtualaddr;
uint8_t* memsource = (uint8_t*) ( ((addr_t)file) + pht->offset); uint8_t* memsource = (uint8_t*) ( ((addr_t)file) + pht->offset);
Maxsi::Memory::Copy(memdest, memsource, pht->filesize); memcpy(memdest, memsource, pht->filesize);
Maxsi::Memory::Set(memdest + pht->filesize, 0, pht->memorysize - pht->filesize); memset(memdest + pht->filesize, 0, pht->memorysize - pht->filesize);
} }
return entry; return entry;
@ -218,8 +218,8 @@ namespace Sortix
// Copy as much data as possible and memset the rest to 0. // Copy as much data as possible and memset the rest to 0.
uint8_t* memdest = (uint8_t*) virtualaddr; uint8_t* memdest = (uint8_t*) virtualaddr;
uint8_t* memsource = (uint8_t*) ( ((addr_t)file) + pht->offset); uint8_t* memsource = (uint8_t*) ( ((addr_t)file) + pht->offset);
Maxsi::Memory::Copy(memdest, memsource, pht->filesize); memcpy(memdest, memsource, pht->filesize);
Maxsi::Memory::Set(memdest + pht->filesize, 0, pht->memorysize - pht->filesize); memset(memdest + pht->filesize, 0, pht->memorysize - pht->filesize);
} }
return entry; return entry;

View File

@ -23,9 +23,9 @@
******************************************************************************/ ******************************************************************************/
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <libmaxsi/memory.h>
#include <libmaxsi/string.h> #include <libmaxsi/string.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include "syscall.h" #include "syscall.h"
#include "process.h" #include "process.h"
#include "filesystem.h" #include "filesystem.h"
@ -140,7 +140,7 @@ namespace Sortix
void HackStat(Device* dev, struct stat* st) void HackStat(Device* dev, struct stat* st)
{ {
Memory::Set(st, 0, sizeof(*st)); memset(st, 0, sizeof(*st));
st->st_mode = 0777; st->st_mode = 0777;
st->st_nlink = 1; st->st_nlink = 1;
if ( dev->IsType(Device::BUFFER) ) if ( dev->IsType(Device::BUFFER) )

View File

@ -24,9 +24,9 @@
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <libmaxsi/string.h> #include <libmaxsi/string.h>
#include <libmaxsi/memory.h>
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include "../filesystem.h" #include "../filesystem.h"
#include "../directory.h" #include "../directory.h"
#include "../stream.h" #include "../stream.h"
@ -212,7 +212,7 @@ namespace Sortix
DevEntry* newdeventries = new DevEntry[newentrieslength]; DevEntry* newdeventries = new DevEntry[newentrieslength];
if ( !newdeventries ) { return false; } if ( !newdeventries ) { return false; }
size_t bytes = sizeof(DevEntry) * entriesused; size_t bytes = sizeof(DevEntry) * entriesused;
Memory::Copy(newdeventries, deventries, bytes); memcpy(newdeventries, deventries, bytes);
delete[] deventries; delete[] deventries;
entrieslength = newentrieslength; entrieslength = newentrieslength;
deventries = newdeventries; deventries = newdeventries;
@ -334,7 +334,7 @@ namespace Sortix
return -1; return -1;
} }
Memory::Copy(dirent->d_name, name, namelen + 1); memcpy(dirent->d_name, name, namelen + 1);
dirent->d_namelen = namelen; dirent->d_namelen = namelen;
position++; position++;
return 0; return 0;

View File

@ -25,8 +25,8 @@
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <sortix/kernel/kthread.h> #include <sortix/kernel/kthread.h>
#include <libmaxsi/string.h> #include <libmaxsi/string.h>
#include <libmaxsi/memory.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include "../filesystem.h" #include "../filesystem.h"
#include "../directory.h" #include "../directory.h"
#include "../stream.h" #include "../stream.h"
@ -120,7 +120,7 @@ namespace Sortix
size_t available = count; size_t available = count;
if ( buffersize < offset + count ) { available = buffersize - offset; } if ( buffersize < offset + count ) { available = buffersize - offset; }
if ( available == 0 ) { return 0; } if ( available == 0 ) { return 0; }
Memory::Copy(dest, buffer + offset, available); memcpy(dest, buffer + offset, available);
offset += available; offset += available;
return available; return available;
} }
@ -198,7 +198,7 @@ namespace Sortix
return -1; return -1;
} }
Memory::Copy(dirent->d_name, name, namelen + 1); memcpy(dirent->d_name, name, namelen + 1);
dirent->d_namelen = namelen; dirent->d_namelen = namelen;
position++; position++;
return 0; return 0;

View File

@ -24,9 +24,9 @@
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <libmaxsi/string.h> #include <libmaxsi/string.h>
#include <libmaxsi/memory.h>
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include "../filesystem.h" #include "../filesystem.h"
#include "../directory.h" #include "../directory.h"
#include "../stream.h" #include "../stream.h"
@ -110,7 +110,7 @@ namespace Sortix
uint8_t* newbuffer = new uint8_t[size]; uint8_t* newbuffer = new uint8_t[size];
if ( !newbuffer ) { errno = ENOSPC; return false; } if ( !newbuffer ) { errno = ENOSPC; return false; }
size_t sharedmemsize = ( size < bufferused ) ? size : bufferused; size_t sharedmemsize = ( size < bufferused ) ? size : bufferused;
Memory::Copy(newbuffer, buffer, sharedmemsize); memcpy(newbuffer, buffer, sharedmemsize);
delete[] buffer; delete[] buffer;
buffer = newbuffer; buffer = newbuffer;
bufferused = sharedmemsize; bufferused = sharedmemsize;
@ -124,7 +124,7 @@ namespace Sortix
size_t available = count; size_t available = count;
if ( bufferused < offset + count ) { available = bufferused - offset; } if ( bufferused < offset + count ) { available = bufferused - offset; }
if ( available == 0 ) { return 0; } if ( available == 0 ) { return 0; }
Memory::Copy(dest, buffer + offset, available); memcpy(dest, buffer + offset, available);
offset += available; offset += available;
return available; return available;
} }
@ -139,7 +139,7 @@ namespace Sortix
if ( !Resize(newsize) ) { return -1; } if ( !Resize(newsize) ) { return -1; }
} }
Memory::Copy(buffer + offset, src, count); memcpy(buffer + offset, src, count);
offset += count; offset += count;
if ( bufferused < offset ) { bufferused = offset; } if ( bufferused < offset ) { bufferused = offset; }
return count; return count;
@ -227,7 +227,7 @@ namespace Sortix
return -1; return -1;
} }
Memory::Copy(dirent->d_name, name, namelen + 1); memcpy(dirent->d_name, name, namelen + 1);
dirent->d_namelen = namelen; dirent->d_namelen = namelen;
position++; position++;
return 0; return 0;

View File

@ -23,9 +23,9 @@
*******************************************************************************/ *******************************************************************************/
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <libmaxsi/memory.h>
#include <libmaxsi/string.h> #include <libmaxsi/string.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include "util.h" #include "util.h"
using namespace Maxsi; using namespace Maxsi;
@ -76,7 +76,7 @@ ssize_t DevStringBuffer::Read(uint8_t* dest, size_t count)
{ {
size_t available = strlength - off; size_t available = strlength - off;
if ( available < count ) { count = available; } if ( available < count ) { count = available; }
Memory::Copy(dest, str + off, count); memcpy(dest, str + off, count);
off += count; off += count;
return count; return count;
} }
@ -122,7 +122,7 @@ ssize_t DevLineCommand::Write(const uint8_t* src, size_t count)
size_t available = CMDMAX - sofar; size_t available = CMDMAX - sofar;
if ( !available && count ) { errno = ENOSPC; return -1; } if ( !available && count ) { errno = ENOSPC; return -1; }
if ( available < count ) { count = available; } if ( available < count ) { count = available; }
Memory::Copy(cmd + sofar, src, count); memcpy(cmd + sofar, src, count);
cmd[sofar += count] = 0; cmd[sofar += count] = 0;
size_t newlinepos = String::Reject(cmd, "\n"); size_t newlinepos = String::Reject(cmd, "\n");
if ( !cmd[newlinepos] ) { return count; } if ( !cmd[newlinepos] ) { return count; }
@ -189,7 +189,7 @@ ssize_t DevMemoryBuffer::Read(uint8_t* dest, size_t count)
if ( bufsize <= off ) { return 0; } if ( bufsize <= off ) { return 0; }
size_t available = bufsize - off; size_t available = bufsize - off;
if ( available < count ) { count = available; } if ( available < count ) { count = available; }
Memory::Copy(dest, buf + off, count); memcpy(dest, buf + off, count);
off += count; off += count;
return count; return count;
} }
@ -200,7 +200,7 @@ ssize_t DevMemoryBuffer::Write(const uint8_t* src, size_t count)
if ( bufsize <= off ) { errno = EPERM; return -1; } if ( bufsize <= off ) { errno = EPERM; return -1; }
size_t available = bufsize - off; size_t available = bufsize - off;
if ( available < count ) { count = available; } if ( available < count ) { count = available; }
Memory::Copy(buf + off, src, count); memcpy(buf + off, src, count);
off += count; off += count;
return count; return count;
} }

View File

@ -24,9 +24,9 @@
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <sortix/kernel/video.h> #include <sortix/kernel/video.h>
#include <libmaxsi/memory.h>
#include <libmaxsi/string.h> #include <libmaxsi/string.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include "../directory.h" #include "../directory.h"
#include "util.h" #include "util.h"
#include "videofs.h" #include "videofs.h"
@ -279,7 +279,7 @@ int DevVideoFSDir::Read(sortix_dirent* dirent, size_t available)
return -1; return -1;
} }
Memory::Copy(dirent->d_name, name, namelen + 1); memcpy(dirent->d_name, name, namelen + 1);
dirent->d_namelen = namelen; dirent->d_namelen = namelen;
position++; position++;
return 0; return 0;

View File

@ -27,10 +27,10 @@
#include <sortix/stat.h> #include <sortix/stat.h>
#include <sortix/mman.h> #include <sortix/mman.h>
#include <sortix/initrd.h> #include <sortix/initrd.h>
#include <libmaxsi/memory.h>
#include <libmaxsi/string.h> #include <libmaxsi/string.h>
#include <libmaxsi/crc32.h> #include <libmaxsi/crc32.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include "initrd.h" #include "initrd.h"
#include "syscall.h" #include "syscall.h"

View File

@ -23,9 +23,9 @@
*******************************************************************************/ *******************************************************************************/
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <libmaxsi/memory.h>
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include "x86-family/idt.h" #include "x86-family/idt.h"
#include "interrupt.h" #include "interrupt.h"
#include "scheduler.h" #include "scheduler.h"
@ -35,8 +35,6 @@
#include "sound.h" // Hack for SIGSEGV #include "sound.h" // Hack for SIGSEGV
using namespace Maxsi;
namespace Sortix { namespace Sortix {
namespace Interrupt { namespace Interrupt {
@ -348,7 +346,7 @@ static void WriteToQueue(const void* src, size_t size)
size_t writeat = (queueoffset + queueused) % queuesize; size_t writeat = (queueoffset + queueused) % queuesize;
size_t available = queuesize - writeat; size_t available = queuesize - writeat;
size_t count = available < size ? available : size; size_t count = available < size ? available : size;
Memory::Copy(queue + writeat, buf, count); memcpy(queue + writeat, buf, count);
queueused += count; queueused += count;
if ( count < size ) { WriteToQueue(buf + count, size - count); } if ( count < size ) { WriteToQueue(buf + count, size - count); }
} }
@ -358,7 +356,7 @@ static void ReadFromQueue(void* dest, size_t size)
uint8_t* buf = (uint8_t*) dest; uint8_t* buf = (uint8_t*) dest;
size_t available = queuesize - queueoffset; size_t available = queuesize - queueoffset;
size_t count = available < size ? available : size; size_t count = available < size ? available : size;
Memory::Copy(buf, queue + queueoffset, count); memcpy(buf, queue + queueoffset, count);
queueused -= count; queueused -= count;
queueoffset = (queueoffset + count) % queuesize; queueoffset = (queueoffset + count) % queuesize;
if ( count < size ) { ReadFromQueue(buf + count, size - count); } if ( count < size ) { ReadFromQueue(buf + count, size - count); }

View File

@ -23,15 +23,13 @@
*******************************************************************************/ *******************************************************************************/
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <libmaxsi/memory.h>
#include <assert.h> #include <assert.h>
#include <string.h>
#include "../interrupt.h" #include "../interrupt.h"
#include "../keyboard.h" #include "../keyboard.h"
#include <sortix/keycodes.h> #include <sortix/keycodes.h>
#include "ps2.h" #include "ps2.h"
using namespace Maxsi;
namespace Sortix namespace Sortix
{ {
const uint16_t DATA = 0x0; const uint16_t DATA = 0x0;
@ -187,8 +185,8 @@ namespace Sortix
size_t leadingavai = queuelength-queueoffset; size_t leadingavai = queuelength-queueoffset;
size_t leading = (leadingavai < queueused) ? leadingavai : queueused; size_t leading = (leadingavai < queueused) ? leadingavai : queueused;
size_t trailing = queueused - leading; size_t trailing = queueused - leading;
Memory::Copy(newqueue, queue + queueoffset, leading * elemsize); memcpy(newqueue, queue + queueoffset, leading * elemsize);
Memory::Copy(newqueue + leading, queue, trailing * elemsize); memcpy(newqueue + leading, queue, trailing * elemsize);
delete[] queue; delete[] queue;
queue = newqueue; queue = newqueue;
queuelength = newqueuelength; queuelength = newqueuelength;

View File

@ -27,12 +27,10 @@
#include <sortix/kernel/refcount.h> #include <sortix/kernel/refcount.h>
#include <sortix/kernel/textbuffer.h> #include <sortix/kernel/textbuffer.h>
#include <sortix/vga.h> #include <sortix/vga.h>
#include <libmaxsi/memory.h> #include <string.h>
#include "vga.h" #include "vga.h"
#include "lfbtextbuffer.h" #include "lfbtextbuffer.h"
using namespace Maxsi;
namespace Sortix { namespace Sortix {
static uint32_t ColorFromRGB(uint8_t r, uint8_t g, uint8_t b) static uint32_t ColorFromRGB(uint8_t r, uint8_t g, uint8_t b)
@ -65,7 +63,7 @@ LFBTextBuffer* CreateLFBTextBuffer(uint8_t* lfb, uint32_t lfbformat,
if ( !(ret = new LFBTextBuffer) ) if ( !(ret = new LFBTextBuffer) )
goto cleanup_attrs; goto cleanup_attrs;
Memory::Copy(font, VGA::GetFont(), fontsize); memcpy(font, VGA::GetFont(), fontsize);
ret->lfb = lfb; ret->lfb = lfb;
ret->lfbformat = lfbformat; ret->lfbformat = lfbformat;
ret->pixelsx = xres; ret->pixelsx = xres;
@ -74,9 +72,9 @@ LFBTextBuffer* CreateLFBTextBuffer(uint8_t* lfb, uint32_t lfbformat,
ret->columns = columns; ret->columns = columns;
ret->rows = rows; ret->rows = rows;
ret->font = font; ret->font = font;
Memory::Set(chars, 0, sizeof(uint16_t) * columns * rows); memset(chars, 0, sizeof(uint16_t) * columns * rows);
ret->chars = chars; ret->chars = chars;
Memory::Set(attrs, 0, sizeof(uint16_t) * columns * rows); memset(attrs, 0, sizeof(uint16_t) * columns * rows);
ret->attrs = attrs; ret->attrs = attrs;
for ( size_t i = 0; i < 16UL; i++ ) for ( size_t i = 0; i < 16UL; i++ )
{ {
@ -88,7 +86,7 @@ LFBTextBuffer* CreateLFBTextBuffer(uint8_t* lfb, uint32_t lfbformat,
ret->cursorenabled = true; ret->cursorenabled = true;
ret->cursorpos = TextPos(0, 0); ret->cursorpos = TextPos(0, 0);
for ( size_t y = 0; y < yres; y++ ) for ( size_t y = 0; y < yres; y++ )
Memory::Set(lfb + scansize * y, 0, lfbformat/8UL * xres); memset(lfb + scansize * y, 0, lfbformat/8UL * xres);
return ret; return ret;
cleanup_attrs: cleanup_attrs:

View File

@ -23,11 +23,9 @@
******************************************************************************/ ******************************************************************************/
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <libmaxsi/memory.h> #include <string.h>
#include "linebuffer.h" #include "linebuffer.h"
using namespace Maxsi;
namespace Sortix namespace Sortix
{ {
static size_t OffsetIndex(size_t offset, size_t index, size_t length) static size_t OffsetIndex(size_t offset, size_t index, size_t length)
@ -63,8 +61,8 @@ namespace Sortix
size_t leadingavai = bufferlength-bufferoffset; size_t leadingavai = bufferlength-bufferoffset;
size_t leading = (leadingavai < bufferused) ? leadingavai : bufferused; size_t leading = (leadingavai < bufferused) ? leadingavai : bufferused;
size_t trailing = bufferused - leading; size_t trailing = bufferused - leading;
Memory::Copy(newbuffer, buffer + bufferoffset, leading * elemsize); memcpy(newbuffer, buffer + bufferoffset, leading * elemsize);
Memory::Copy(newbuffer + leading, buffer, trailing * elemsize); memcpy(newbuffer + leading, buffer, trailing * elemsize);
delete[] buffer; delete[] buffer;
buffer = newbuffer; buffer = newbuffer;
bufferlength = newbufferlength; bufferlength = newbufferlength;

View File

@ -24,7 +24,7 @@
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <libmaxsi/string.h> #include <libmaxsi/string.h>
#include <libmaxsi/memory.h> #include <string.h>
#include <sortix/kernel/log.h> #include <sortix/kernel/log.h>
#include "syscall.h" #include "syscall.h"

View File

@ -25,8 +25,8 @@
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <sortix/keycodes.h> #include <sortix/keycodes.h>
#include <sortix/signal.h> #include <sortix/signal.h>
#include <libmaxsi/memory.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include "utf8.h" #include "utf8.h"
#include "keyboard.h" #include "keyboard.h"
#include "process.h" #include "process.h"
@ -288,7 +288,7 @@ namespace Sortix
bufsize -= partiallywritten; bufsize -= partiallywritten;
if ( sofar && left < bufsize ) { return sofar; } if ( sofar && left < bufsize ) { return sofar; }
size_t amount = left < bufsize ? left : bufsize; size_t amount = left < bufsize ? left : bufsize;
Memory::Copy(dest + sofar, buf, amount); memcpy(dest + sofar, buf, amount);
partiallywritten = (amount < bufsize) ? partiallywritten + amount : 0; partiallywritten = (amount < bufsize) ? partiallywritten + amount : 0;
left -= amount; left -= amount;
sofar += amount; sofar += amount;

View File

@ -23,9 +23,9 @@
******************************************************************************/ ******************************************************************************/
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <libmaxsi/memory.h>
#include <libmaxsi/string.h>
#include <sortix/kernel/panic.h> #include <sortix/kernel/panic.h>
#include <libmaxsi/string.h>
#include <string.h>
#include "mount.h" #include "mount.h"
#include "fs/ramfs.h" #include "fs/ramfs.h"
#include "fs/initfs.h" #include "fs/initfs.h"

View File

@ -24,7 +24,7 @@
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <libmaxsi/string.h> #include <libmaxsi/string.h>
#include <libmaxsi/memory.h> #include <string.h>
#include "interrupt.h" #include "interrupt.h"
#include <sortix/kernel/log.h> #include <sortix/kernel/log.h>
#include "calltrace.h" #include "calltrace.h"

View File

@ -25,9 +25,9 @@
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <sortix/kernel/kthread.h> #include <sortix/kernel/kthread.h>
#include <sortix/signal.h> #include <sortix/signal.h>
#include <libmaxsi/memory.h>
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#ifdef GOT_FAKE_KTHREAD #ifdef GOT_FAKE_KTHREAD
#include "event.h" #include "event.h"
#endif #endif
@ -37,8 +37,6 @@
#include "syscall.h" #include "syscall.h"
#include "pipe.h" #include "pipe.h"
using namespace Maxsi;
namespace Sortix namespace Sortix
{ {
class DevPipeStorage : public DevStream class DevPipeStorage : public DevStream
@ -118,7 +116,7 @@ namespace Sortix
size_t linear = buffersize - bufferoffset; size_t linear = buffersize - bufferoffset;
if ( linear < amount ) { amount = linear; } if ( linear < amount ) { amount = linear; }
assert(amount); assert(amount);
Memory::Copy(dest, buffer + bufferoffset, amount); memcpy(dest, buffer + bufferoffset, amount);
bufferoffset = (bufferoffset + amount) % buffersize; bufferoffset = (bufferoffset + amount) % buffersize;
bufferused -= amount; bufferused -= amount;
kthread_cond_broadcast(&writecond); kthread_cond_broadcast(&writecond);
@ -131,7 +129,7 @@ namespace Sortix
size_t linear = buffersize - bufferoffset; size_t linear = buffersize - bufferoffset;
if ( linear < amount ) { amount = linear; } if ( linear < amount ) { amount = linear; }
assert(amount); assert(amount);
Memory::Copy(dest, buffer + bufferoffset, amount); memcpy(dest, buffer + bufferoffset, amount);
bufferoffset = (bufferoffset + amount) % buffersize; bufferoffset = (bufferoffset + amount) % buffersize;
bufferused -= amount; bufferused -= amount;
writeevent.Signal(); writeevent.Signal();
@ -172,7 +170,7 @@ namespace Sortix
size_t linear = buffersize - writeoffset; size_t linear = buffersize - writeoffset;
if ( linear < amount ) { amount = linear; } if ( linear < amount ) { amount = linear; }
assert(amount); assert(amount);
Memory::Copy(buffer + writeoffset, src, amount); memcpy(buffer + writeoffset, src, amount);
bufferused += amount; bufferused += amount;
kthread_cond_broadcast(&readcond); kthread_cond_broadcast(&readcond);
return amount; return amount;
@ -185,7 +183,7 @@ namespace Sortix
size_t linear = buffersize - writeoffset; size_t linear = buffersize - writeoffset;
if ( linear < amount ) { amount = linear; } if ( linear < amount ) { amount = linear; }
assert(amount); assert(amount);
Memory::Copy(buffer + writeoffset, src, amount); memcpy(buffer + writeoffset, src, amount);
bufferused += amount; bufferused += amount;
readevent.Signal(); readevent.Signal();
return amount; return amount;

View File

@ -31,11 +31,11 @@
#include <sortix/fork.h> #include <sortix/fork.h>
#include <sortix/mman.h> #include <sortix/mman.h>
#include <sortix/wait.h> #include <sortix/wait.h>
#include <libmaxsi/memory.h>
#include <libmaxsi/string.h> #include <libmaxsi/string.h>
#include <libmaxsi/sortedlist.h> #include <libmaxsi/sortedlist.h>
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include "thread.h" #include "thread.h"
#include "process.h" #include "process.h"
#include "device.h" #include "device.h"
@ -533,7 +533,7 @@ namespace Sortix
argvsize += len; argvsize += len;
char* dest = ((char*) argvpos) - argvsize; char* dest = ((char*) argvpos) - argvsize;
stackargv[i] = dest; stackargv[i] = dest;
Maxsi::Memory::Copy(dest, argv[i], len); memcpy(dest, argv[i], len);
} }
stackargv[argc] = NULL; stackargv[argc] = NULL;
@ -551,7 +551,7 @@ namespace Sortix
envpsize += len; envpsize += len;
char* dest = ((char*) envppos) - envpsize; char* dest = ((char*) envppos) - envpsize;
stackenvp[i] = dest; stackenvp[i] = dest;
Maxsi::Memory::Copy(dest, envp[i], len); memcpy(dest, envp[i], len);
} }
stackenvp[envc] = NULL; stackenvp[envc] = NULL;
@ -596,7 +596,7 @@ namespace Sortix
int result = -1; int result = -1;
Process* process = CurrentProcess(); Process* process = CurrentProcess();
CPU::InterruptRegisters regs; CPU::InterruptRegisters regs;
Maxsi::Memory::Set(&regs, 0, sizeof(regs)); memset(&regs, 0, sizeof(regs));
filename = String::Clone(_filename); filename = String::Clone(_filename);
if ( !filename ) { goto cleanup_done; } if ( !filename ) { goto cleanup_done; }
@ -606,7 +606,7 @@ namespace Sortix
argv = new char*[argc+1]; argv = new char*[argc+1];
if ( !argv ) { goto cleanup_filename; } if ( !argv ) { goto cleanup_filename; }
Maxsi::Memory::Set(argv, 0, sizeof(char*) * (argc+1)); memset(argv, 0, sizeof(char*) * (argc+1));
for ( int i = 0; i < argc; i++ ) for ( int i = 0; i < argc; i++ )
{ {
@ -617,7 +617,7 @@ namespace Sortix
envp = new char*[envc+1]; envp = new char*[envc+1];
if ( !envp ) { goto cleanup_argv; } if ( !envp ) { goto cleanup_argv; }
envc = envc; envc = envc;
Maxsi::Memory::Set(envp, 0, sizeof(char*) * (envc+1)); memset(envp, 0, sizeof(char*) * (envc+1));
for ( int i = 0; i < envc; i++ ) for ( int i = 0; i < envc; i++ )
{ {

View File

@ -24,8 +24,8 @@
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <sortix/kernel/memorymanagement.h> #include <sortix/kernel/memorymanagement.h>
#include <libmaxsi/memory.h>
#include <assert.h> #include <assert.h>
#include <string.h>
#include "x86-family/gdt.h" #include "x86-family/gdt.h"
#include "x86-family/float.h" #include "x86-family/float.h"
#include "syscall.h" #include "syscall.h"
@ -36,8 +36,6 @@
#include "signal.h" #include "signal.h"
#include "scheduler.h" #include "scheduler.h"
using namespace Maxsi;
namespace Sortix { namespace Sortix {
namespace Scheduler { namespace Scheduler {
@ -274,7 +272,7 @@ void Init()
// current thread is accessed. This lets us avoid checking whether it is // current thread is accessed. This lets us avoid checking whether it is
// NULL (which it only will be once), which gives simpler code. // NULL (which it only will be once), which gives simpler code.
dummythread = (Thread*) &dummythreaddata; dummythread = (Thread*) &dummythreaddata;
Maxsi::Memory::Set(dummythread, 0, sizeof(*dummythread)); memset(dummythread, 0, sizeof(*dummythread));
dummythread->schedulerlistprev = dummythread; dummythread->schedulerlistprev = dummythread;
dummythread->schedulerlistnext = dummythread; dummythread->schedulerlistnext = dummythread;
currentthread = dummythread; currentthread = dummythread;

View File

@ -25,14 +25,12 @@
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <sortix/kernel/panic.h> #include <sortix/kernel/panic.h>
#include <sortix/signal.h> #include <sortix/signal.h>
#include <libmaxsi/memory.h>
#include <assert.h> #include <assert.h>
#include <string.h>
#include "interrupt.h" #include "interrupt.h"
#include "thread.h" #include "thread.h"
#include "signal.h" #include "signal.h"
using namespace Maxsi;
namespace Sortix { namespace Sortix {
// A per-cpu value whether a signal is pending in the running task. // A per-cpu value whether a signal is pending in the running task.

View File

@ -27,9 +27,9 @@
#include <sortix/kernel/memorymanagement.h> #include <sortix/kernel/memorymanagement.h>
#include <sortix/mman.h> #include <sortix/mman.h>
#include <sortix/signal.h> #include <sortix/signal.h>
#include <libmaxsi/memory.h>
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include "process.h" #include "process.h"
#include "thread.h" #include "thread.h"
#include "scheduler.h" #include "scheduler.h"
@ -37,8 +37,6 @@
#include "time.h" #include "time.h"
#include "syscall.h" #include "syscall.h"
using namespace Maxsi;
namespace Sortix namespace Sortix
{ {
Thread::Thread() Thread::Thread()
@ -50,7 +48,7 @@ namespace Sortix
schedulerlistprev = NULL; schedulerlistprev = NULL;
schedulerlistnext = NULL; schedulerlistnext = NULL;
state = NONE; state = NONE;
Maxsi::Memory::Set(&registers, 0, sizeof(registers)); memset(&registers, 0, sizeof(registers));
stackpos = 0; stackpos = 0;
stacksize = 0; stacksize = 0;
kernelstackpos = 0; kernelstackpos = 0;
@ -211,7 +209,7 @@ namespace Sortix
int level = siglevel++; int level = siglevel++;
signums[level] = currentsignal = signum; signums[level] = currentsignal = signum;
Maxsi::Memory::Copy(sigregs + level, regs, sizeof(*regs)); memcpy(sigregs + level, regs, sizeof(*regs));
HandleSignalCPU(regs); HandleSignalCPU(regs);
} }
@ -224,7 +222,7 @@ namespace Sortix
siglevel--; siglevel--;
currentsignal = siglevel ? signums[siglevel-1] : 0; currentsignal = siglevel ? signums[siglevel-1] : 0;
Maxsi::Memory::Copy(regs, sigregs + siglevel, sizeof(*regs)); memcpy(regs, sigregs + siglevel, sizeof(*regs));
regs->signal_pending = 0; regs->signal_pending = 0;
// Check if a more important signal is pending. // Check if a more important signal is pending.

View File

@ -25,7 +25,7 @@
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include "cpu.h" #include "cpu.h"
#include <libmaxsi/string.h> #include <libmaxsi/string.h>
#include <libmaxsi/memory.h> #include <string.h>
#include "vga.h" #include "vga.h"
#include "uart.h" #include "uart.h"

View File

@ -23,8 +23,8 @@
*******************************************************************************/ *******************************************************************************/
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <libmaxsi/memory.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include "fs/util.h" #include "fs/util.h"
#include "fs/devfs.h" #include "fs/devfs.h"
#include "vga.h" #include "vga.h"
@ -35,8 +35,6 @@
#define TEST_VGAFONT 0 #define TEST_VGAFONT 0
using namespace Maxsi;
namespace Sortix { namespace Sortix {
namespace VGA { namespace VGA {
@ -86,7 +84,7 @@ static void FetchVGAFont(uint8_t* font)
{ {
const uint8_t* src = data + (32*8)/8 * i; const uint8_t* src = data + (32*8)/8 * i;
uint8_t* dest = font + VGA_FONT_CHARSIZE * i; uint8_t* dest = font + VGA_FONT_CHARSIZE * i;
Memory::Copy(dest, src, VGA_FONT_CHARSIZE); memcpy(dest, src, VGA_FONT_CHARSIZE);
} }
// Restore the VGA state. // Restore the VGA state.
WriteIndex(0x03C4, 0x02, old_03c4_02); WriteIndex(0x03C4, 0x02, old_03c4_02);
@ -176,7 +174,7 @@ DevVGA::~DevVGA()
ssize_t DevVGA::Read(uint8_t* dest, size_t count) ssize_t DevVGA::Read(uint8_t* dest, size_t count)
{ {
if ( VGA::VGA_SIZE - offset < count ) { count = VGA::VGA_SIZE - offset; } if ( VGA::VGA_SIZE - offset < count ) { count = VGA::VGA_SIZE - offset; }
Maxsi::Memory::Copy(dest, VGA::VGA + offset, count); memcpy(dest, VGA::VGA + offset, count);
offset += count; offset += count;
return count; return count;
} }
@ -185,7 +183,7 @@ ssize_t DevVGA::Write(const uint8_t* src, size_t count)
{ {
if ( offset == VGA::VGA_SIZE && count ) { errno = ENOSPC; return -1; } if ( offset == VGA::VGA_SIZE && count ) { errno = ENOSPC; return -1; }
if ( VGA::VGA_SIZE - offset < count ) { count = VGA::VGA_SIZE - offset; } if ( VGA::VGA_SIZE - offset < count ) { count = VGA::VGA_SIZE - offset; }
Maxsi::Memory::Copy(VGA::VGA + offset, src, count); memcpy(VGA::VGA + offset, src, count);
offset = (offset + count) % VGA::VGA_SIZE; offset = (offset + count) % VGA::VGA_SIZE;
VGA::SetCursor(VGA::WIDTH, VGA::HEIGHT-1); VGA::SetCursor(VGA::WIDTH, VGA::HEIGHT-1);
#ifdef PLATFORM_SERIAL #ifdef PLATFORM_SERIAL

View File

@ -28,8 +28,8 @@
#include <sortix/kernel/video.h> #include <sortix/kernel/video.h>
#include <stdarg.h> #include <stdarg.h>
#include <errno.h> #include <errno.h>
#include <libmaxsi/memory.h>
#include <libmaxsi/string.h> #include <libmaxsi/string.h>
#include <string.h>
using namespace Maxsi; using namespace Maxsi;
@ -136,7 +136,7 @@ bool RegisterDriver(const char* name, VideoDriver* driver)
size_t newdriverslen = driverslen ? 2 * driverslen : 8UL; size_t newdriverslen = driverslen ? 2 * driverslen : 8UL;
DriverEntry* newdrivers = new DriverEntry[newdriverslen]; DriverEntry* newdrivers = new DriverEntry[newdriverslen];
if ( !newdrivers ) { return false; } if ( !newdrivers ) { return false; }
Memory::Copy(newdrivers, drivers, sizeof(*drivers) * numdrivers); memcpy(newdrivers, drivers, sizeof(*drivers) * numdrivers);
delete[] drivers; drivers = newdrivers; delete[] drivers; drivers = newdrivers;
driverslen = driverslen; driverslen = driverslen;
} }
@ -161,7 +161,7 @@ static bool ExpandModesArray(size_t needed)
if ( newmodeslen < modesneeded ) { newmodeslen = modesneeded; } if ( newmodeslen < modesneeded ) { newmodeslen = modesneeded; }
char** newmodes = new char*[newmodeslen]; char** newmodes = new char*[newmodeslen];
if ( !newmodes ) { return false; } if ( !newmodes ) { return false; }
Memory::Copy(newmodes, modes, sizeof(char*) * nummodes); memcpy(newmodes, modes, sizeof(char*) * nummodes);
delete[] modes; modes = newmodes; delete[] modes; modes = newmodes;
modeslen = newmodeslen; modeslen = newmodeslen;
return true; return true;

View File

@ -24,7 +24,7 @@
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <sortix/kernel/memorymanagement.h> #include <sortix/kernel/memorymanagement.h>
#include <libmaxsi/memory.h> #include <string.h>
#include "multiboot.h" #include "multiboot.h"
#include "x86-family/memorymanagement.h" #include "x86-family/memorymanagement.h"
#include "interrupt.h" #include "interrupt.h"

View File

@ -24,7 +24,7 @@
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <sortix/fork.h> #include <sortix/fork.h>
#include <libmaxsi/memory.h> #include <string.h>
#include "process.h" #include "process.h"
namespace Sortix namespace Sortix
@ -53,7 +53,7 @@ namespace Sortix
void InitializeThreadRegisters(CPU::InterruptRegisters* regs, void InitializeThreadRegisters(CPU::InterruptRegisters* regs,
const tforkregs_t* requested) const tforkregs_t* requested)
{ {
Maxsi::Memory::Set(regs, 0, sizeof(*regs)); memset(regs, 0, sizeof(*regs));
regs->rip = requested->rip; regs->rip = requested->rip;
regs->userrsp = requested->rsp; regs->userrsp = requested->rsp;
regs->rax = requested->rax; regs->rax = requested->rax;

View File

@ -23,7 +23,7 @@
*******************************************************************************/ *******************************************************************************/
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <libmaxsi/memory.h> #include <string.h>
#include "gdt.h" #include "gdt.h"
using namespace Maxsi; using namespace Maxsi;
@ -122,7 +122,7 @@ namespace Sortix
#endif #endif
// Ensure the descriptor is initially zero. // Ensure the descriptor is initially zero.
Memory::Set(&tss_entry, 0, sizeof(tss_entry)); memset(&tss_entry, 0, sizeof(tss_entry));
#ifdef PLATFORM_X86 #ifdef PLATFORM_X86
tss_entry.ss0 = ss0; // Set the kernel stack segment. tss_entry.ss0 = ss0; // Set the kernel stack segment.

View File

@ -23,7 +23,7 @@
*******************************************************************************/ *******************************************************************************/
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <libmaxsi/memory.h> #include <string.h>
#include "idt.h" #include "idt.h"
using namespace Maxsi; using namespace Maxsi;
@ -42,7 +42,7 @@ namespace Sortix
idt_ptr.limit = sizeof(idt_entry_t) * 256 - 1; idt_ptr.limit = sizeof(idt_entry_t) * 256 - 1;
idt_ptr.base = (addr_t) &idt_entries; idt_ptr.base = (addr_t) &idt_entries;
Memory::Set(&idt_entries, 0, sizeof(idt_entry_t)*256); memset(&idt_entries, 0, sizeof(idt_entry_t)*256);
} }
void Flush() void Flush()

View File

@ -27,9 +27,9 @@
#include <sortix/kernel/kthread.h> #include <sortix/kernel/kthread.h>
#include <sortix/kernel/memorymanagement.h> #include <sortix/kernel/memorymanagement.h>
#include <sortix/mman.h> #include <sortix/mman.h>
#include <libmaxsi/memory.h>
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <string.h>
#include "multiboot.h" #include "multiboot.h"
#include "memorymanagement.h" #include "memorymanagement.h"
#include "syscall.h" #include "syscall.h"
@ -230,7 +230,7 @@ namespace Sortix
// Invalidate the new PML and reset it to zeroes. // Invalidate the new PML and reset it to zeroes.
addr_t pmladdr = (addr_t) (PMLS[TOPPMLLEVEL-1] + i); addr_t pmladdr = (addr_t) (PMLS[TOPPMLLEVEL-1] + i);
InvalidatePage(pmladdr); InvalidatePage(pmladdr);
Maxsi::Memory::Set((void*) pmladdr, 0, sizeof(PML)); memset((void*) pmladdr, 0, sizeof(PML));
} }
} }
} }
@ -556,7 +556,7 @@ namespace Sortix
// Invalidate the new PML and reset it to zeroes. // Invalidate the new PML and reset it to zeroes.
addr_t pmladdr = (addr_t) (PMLS[i-1] + childoffset); addr_t pmladdr = (addr_t) (PMLS[i-1] + childoffset);
InvalidatePage(pmladdr); InvalidatePage(pmladdr);
Maxsi::Memory::Set((void*) pmladdr, 0, sizeof(PML)); memset((void*) pmladdr, 0, sizeof(PML));
} }
offset = childoffset; offset = childoffset;
@ -713,7 +713,7 @@ namespace Sortix
// Determine the destination page's address. // Determine the destination page's address.
void* dest = (void*) (FORKPML + level - 1); void* dest = (void*) (FORKPML + level - 1);
Maxsi::Memory::Copy(dest, src, 4096UL); memcpy(dest, src, 4096UL);
} }
return true; return true;

View File

@ -23,7 +23,7 @@
*******************************************************************************/ *******************************************************************************/
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <libmaxsi/memory.h> #include <string.h>
#include "multiboot.h" #include "multiboot.h"
#include <sortix/kernel/panic.h> #include <sortix/kernel/panic.h>
#include <sortix/kernel/memorymanagement.h> #include <sortix/kernel/memorymanagement.h>
@ -50,7 +50,7 @@ namespace Sortix
PML* const IDENPML1 = (PML* const) 0x14000UL; PML* const IDENPML1 = (PML* const) 0x14000UL;
// Initialize the memory structures with zeroes. // Initialize the memory structures with zeroes.
Maxsi::Memory::Set((PML* const) 0x11000UL, 0, 0x6000UL); memset((PML* const) 0x11000UL, 0, 0x6000UL);
// Identity map the first 4 MiB. // Identity map the first 4 MiB.
addr_t flags = PML_PRESENT | PML_WRITABLE; addr_t flags = PML_PRESENT | PML_WRITABLE;

View File

@ -24,7 +24,7 @@
#include <sortix/kernel/platform.h> #include <sortix/kernel/platform.h>
#include <sortix/fork.h> #include <sortix/fork.h>
#include <libmaxsi/memory.h> #include <string.h>
#include "process.h" #include "process.h"
namespace Sortix namespace Sortix
@ -49,7 +49,7 @@ namespace Sortix
void InitializeThreadRegisters(CPU::InterruptRegisters* regs, void InitializeThreadRegisters(CPU::InterruptRegisters* regs,
const tforkregs_t* requested) const tforkregs_t* requested)
{ {
Maxsi::Memory::Set(regs, 0, sizeof(*regs)); memset(regs, 0, sizeof(*regs));
regs->eip = requested->eip; regs->eip = requested->eip;
regs->useresp = requested->esp; regs->useresp = requested->esp;
regs->eax = requested->eax; regs->eax = requested->eax;