Rename std functions to match the standard

This commit is contained in:
Alex
2023-03-23 04:56:49 +02:00
parent 4cd4e4cdc6
commit f86f3d9293
50 changed files with 1635 additions and 979 deletions

View File

@ -31,7 +31,7 @@ namespace Execute
} InterpreterIPCData;
/* Passing arguments as a sanity check and debugging. */
void ELFInterpreterIPCThread(PCB *Process, char *Path, void *MemoryImage, void *ElfFile, Vector<String> NeededLibraries)
void ELFInterpreterIPCThread(PCB *Process, char *Path, void *MemoryImage, void *ElfFile, std::vector<const char *> NeededLibraries)
{
debug("Interpreter thread started for %s", Path);
// Interpreter will create an IPC with token "LOAD".
@ -56,7 +56,7 @@ namespace Execute
warn("Too many libraries! (max 256)");
for (size_t i = 0; i < NeededLibraries.size(); i++)
{
strcpy(TmpBuffer->Libraries[i].Name, NeededLibraries[i].c_str());
strcpy(TmpBuffer->Libraries[i].Name, NeededLibraries[i]);
}
#ifdef DEBUG
@ -66,7 +66,7 @@ namespace Execute
debug("MemoryImage: %p", MemoryImage);
for (size_t i = 0; i < NeededLibraries.size(); i++)
{
debug("Library: %s", NeededLibraries[i].c_str());
debug("Library: %s", NeededLibraries[i]);
}
debug("INSIDE DATA");
debug("Path: %s", TmpBuffer->Path);
@ -93,10 +93,10 @@ namespace Execute
}
PCB *InterpreterTargetProcess;
String *InterpreterTargetPath; /* We can't have String as a constructor :( */
std::string *InterpreterTargetPath; /* We can't have String as a constructor :( */
void *InterpreterMemoryImage;
void *InterpreterElfFile;
Vector<String> InterpreterNeededLibraries;
std::vector<const char *> InterpreterNeededLibraries;
void ELFInterpreterThreadWrapper()
{
ELFInterpreterIPCThread(InterpreterTargetProcess, (char *)InterpreterTargetPath->c_str(), InterpreterMemoryImage, InterpreterElfFile, InterpreterNeededLibraries);
@ -111,7 +111,7 @@ namespace Execute
cwk_path_get_basename(Path, &BaseName, nullptr);
TaskArchitecture Arch = TaskArchitecture::UnknownArchitecture;
SharedPointer<File> ExFile = vfs->Open(Path);
std::shared_ptr<File> ExFile = vfs->Open(Path);
if (ExFile->Status != FileStatus::OK)
{
@ -230,7 +230,7 @@ namespace Execute
debug("ElfFile: %p ELFHeader: %p", ElfFile, ELFHeader);
InterpreterTargetProcess = Process;
InterpreterTargetPath = new String(Path); /* We store in a String because Path may get changed while outside ELFLoad(). */
InterpreterTargetPath = new std::string(Path); /* We store in a String because Path may get changed while outside ELFLoad(). */
InterpreterMemoryImage = bl.VirtualMemoryImage;
InterpreterElfFile = ElfFile;
InterpreterNeededLibraries = bl.NeededLibraries;

View File

@ -136,8 +136,8 @@ namespace Execute
break;
}
String ReqLib = (char *)((uintptr_t)ElfFile + DynamicString->sh_offset + Dynamic[i].d_un.d_val);
debug("DT_NEEDED - Name[%ld]: %s", i, ReqLib.c_str());
const char *ReqLib = (const char *)((uintptr_t)ElfFile + DynamicString->sh_offset + Dynamic[i].d_un.d_val);
debug("DT_NEEDED - Name[%ld]: %s", i, ReqLib);
ELFBase.NeededLibraries.push_back(ReqLib);
}
else if (Dynamic[i].d_tag == DT_NULL)
@ -154,7 +154,7 @@ namespace Execute
memcpy((void *)InterpreterPath, (uint8_t *)ElfFile + ItrPhdr.p_offset, 256);
debug("Interpreter: %s", InterpreterPath);
SharedPointer<VirtualFileSystem::File> InterpreterFile = vfs->Open(InterpreterPath);
std::shared_ptr<VirtualFileSystem::File> InterpreterFile = vfs->Open(InterpreterPath);
if (InterpreterFile->Status != VirtualFileSystem::FileStatus::OK)
warn("Failed to open interpreter file: %s", InterpreterPath);

View File

@ -207,7 +207,7 @@ namespace Execute
}
/* No need to check if it's valid, the GetBinaryType() call above does that. */
SharedPointer<VirtualFileSystem::File> File = vfs->Open(Interpreter);
std::shared_ptr<VirtualFileSystem::File> File = vfs->Open(Interpreter);
Elf64_Ehdr *ELFHeader = (Elf64_Ehdr *)File->node->Address;

View File

@ -21,7 +21,7 @@ NewLock(ExecuteServiceLock);
namespace Execute
{
Memory::MemMgr *mem = nullptr;
Vector<SharedLibraries> Libs;
std::vector<SharedLibraries> Libs;
void StartExecuteService()
{

View File

@ -69,7 +69,7 @@ namespace Execute
BinaryType GetBinaryType(char *Path)
{
BinaryType Type = BinaryType::BinTypeInvalid;
SharedPointer<VirtualFileSystem::File> ExFile = vfs->Open(Path);
std::shared_ptr<VirtualFileSystem::File> ExFile = vfs->Open(Path);
if (ExFile->Status == VirtualFileSystem::FileStatus::OK)
{

View File

@ -20,7 +20,7 @@ namespace Execute
.Process = nullptr,
.Thread = nullptr};
SharedPointer<VirtualFileSystem::File> ExFile = vfs->Open(Path);
std::shared_ptr<VirtualFileSystem::File> ExFile = vfs->Open(Path);
if (ExFile->Status == VirtualFileSystem::FileStatus::OK)
{
@ -48,7 +48,7 @@ namespace Execute
for (size_t i = 0; i < TO_PAGES(ExFile->node->Length); i++)
pva.Map((void *)((uintptr_t)BaseImage + (i * PAGE_SIZE)), (void *)((uintptr_t)BaseImage + (i * PAGE_SIZE)), Memory::PTFlag::RW | Memory::PTFlag::US);
Vector<AuxiliaryVector> auxv; // TODO!
std::vector<AuxiliaryVector> auxv; // TODO!
TCB *Thread = TaskManager->CreateThread(Process,
(IP)FexHdr->EntryPoint,