2023-07-03 13:10:16 +02:00
|
|
|
#pragma once
|
|
|
|
|
#include "orbis-config.hpp"
|
2023-07-05 00:43:47 +02:00
|
|
|
|
|
|
|
|
#include "../evf.hpp"
|
|
|
|
|
#include "../thread/Thread.hpp"
|
|
|
|
|
#include "../thread/types.hpp"
|
|
|
|
|
#include "ProcessState.hpp"
|
2023-07-03 13:10:16 +02:00
|
|
|
#include "orbis/module/Module.hpp"
|
|
|
|
|
#include "orbis/utils/IdMap.hpp"
|
|
|
|
|
#include "orbis/utils/SharedMutex.hpp"
|
|
|
|
|
|
|
|
|
|
#include <mutex>
|
|
|
|
|
|
|
|
|
|
namespace orbis {
|
|
|
|
|
class KernelContext;
|
|
|
|
|
struct Thread;
|
|
|
|
|
struct ProcessOps;
|
|
|
|
|
struct sysentvec;
|
|
|
|
|
|
2023-07-10 03:47:29 +02:00
|
|
|
struct NamedObjInfo {
|
|
|
|
|
void *idptr;
|
|
|
|
|
uint16_t ty;
|
|
|
|
|
};
|
|
|
|
|
|
2023-07-03 13:10:16 +02:00
|
|
|
struct Process {
|
|
|
|
|
KernelContext *context = nullptr;
|
|
|
|
|
pid_t pid = -1;
|
|
|
|
|
sysentvec *sysent = nullptr;
|
|
|
|
|
ProcessState state = ProcessState::NEW;
|
|
|
|
|
Process *parentProcess = nullptr;
|
|
|
|
|
shared_mutex mtx;
|
2023-07-05 00:43:47 +02:00
|
|
|
void (*onSysEnter)(Thread *thread, int id, uint64_t *args,
|
|
|
|
|
int argsCount) = nullptr;
|
|
|
|
|
void (*onSysExit)(Thread *thread, int id, uint64_t *args, int argsCount,
|
|
|
|
|
SysResult result) = nullptr;
|
2023-07-03 13:10:16 +02:00
|
|
|
ptr<void> processParam = nullptr;
|
|
|
|
|
uint64_t processParamSize = 0;
|
|
|
|
|
const ProcessOps *ops = nullptr;
|
|
|
|
|
|
|
|
|
|
std::uint64_t nextTlsSlot = 1;
|
|
|
|
|
std::uint64_t lastTlsOffset = 0;
|
|
|
|
|
|
2023-07-05 00:43:47 +02:00
|
|
|
utils::RcIdMap<EventFlag, sint, 4097, 1> evfMap;
|
2023-07-03 13:10:16 +02:00
|
|
|
utils::RcIdMap<Module, ModuleHandle> modulesMap;
|
|
|
|
|
utils::OwningIdMap<Thread, lwpid_t> threadsMap;
|
|
|
|
|
utils::RcIdMap<utils::RcBase, sint> fileDescriptors;
|
2023-07-08 15:44:05 +02:00
|
|
|
|
|
|
|
|
// Named objects for debugging
|
|
|
|
|
utils::shared_mutex namedObjMutex;
|
2023-07-08 16:40:10 +02:00
|
|
|
utils::kmap<void *, utils::kstring> namedObjNames;
|
2023-07-15 16:00:47 +02:00
|
|
|
utils::OwningIdMap<NamedObjInfo, uint, 65535, 1> namedObjIds;
|
2023-07-03 13:10:16 +02:00
|
|
|
};
|
|
|
|
|
} // namespace orbis
|