mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-05-30 08:17:58 +00:00
Userspace process creation stub
This commit is contained in:
parent
efea5e7aaf
commit
bb92e820fc
6
Execute/Parse.cpp
Normal file
6
Execute/Parse.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include <exec.hpp>
|
||||
|
||||
namespace Execute
|
||||
{
|
||||
|
||||
}
|
9
Execute/Spawn.cpp
Normal file
9
Execute/Spawn.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
#include <exec.hpp>
|
||||
|
||||
namespace Execute
|
||||
{
|
||||
ExStatus Spawn(char *Path, uint64_t Arg0, uint64_t Arg1)
|
||||
{
|
||||
return ExStatus::Unknown;
|
||||
}
|
||||
}
|
22
KThread.cpp
22
KThread.cpp
@ -1,9 +1,11 @@
|
||||
#include "kernel.h"
|
||||
|
||||
#include <filesystem/ustar.hpp>
|
||||
#include <vector.hpp>
|
||||
#include <power.hpp>
|
||||
#include <lock.hpp>
|
||||
#include <printf.h>
|
||||
#include <exec.hpp>
|
||||
#include <cwalk.h>
|
||||
|
||||
#include "DAPI.hpp"
|
||||
@ -65,7 +67,25 @@ void KernelMainThread()
|
||||
TaskManager->WaitForThread(CurrentWorker);
|
||||
|
||||
KPrint("Waiting for userspace process to start...");
|
||||
/* Load init file */
|
||||
|
||||
Vector<char *> argv;
|
||||
int argc = 0;
|
||||
|
||||
/* ... */
|
||||
argv.push_back((char *)"--start");
|
||||
/* ... */
|
||||
|
||||
argv.push_back(nullptr);
|
||||
argc = argv.size() - 1;
|
||||
|
||||
// TODO: Untested!
|
||||
Execute::ExStatus ret = Execute::Spawn(Config.InitPath, argc, (uint64_t)argv.data());
|
||||
if (ret != Execute::ExStatus::OK)
|
||||
{
|
||||
KPrint("\eE85230Failed to start %s! Code: %d", Config.InitPath, ret);
|
||||
CPU::Halt(true);
|
||||
}
|
||||
TaskManager->GetCurrentThread()->SetPriority(1);
|
||||
CPU::Halt(true);
|
||||
}
|
||||
|
||||
|
23
include/exec.hpp
Normal file
23
include/exec.hpp
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef __FENNIX_KERNEL_FILE_EXECUTE_H__
|
||||
#define __FENNIX_KERNEL_FILE_EXECUTE_H__
|
||||
|
||||
#include <types.h>
|
||||
|
||||
namespace Execute
|
||||
{
|
||||
enum ExStatus
|
||||
{
|
||||
OK,
|
||||
Unknown,
|
||||
InvalidFile,
|
||||
InvalidFileFormat,
|
||||
InvalidFileHeader,
|
||||
InvalidFileData,
|
||||
InvalidFileEntryPoint,
|
||||
InvalidFilePath
|
||||
};
|
||||
|
||||
ExStatus Spawn(char *Path, uint64_t Arg0, uint64_t Arg1);
|
||||
}
|
||||
|
||||
#endif // !__FENNIX_KERNEL_FILE_EXECUTE_H__
|
Loading…
x
Reference in New Issue
Block a user