Unverified Commit 08a1f640 authored by PhoeniX's avatar PhoeniX

Process naming support

parent 77780aac
......@@ -31,6 +31,7 @@ class Process {
uintptr_t _aslrCode, _aslrStack, _syscallPage;
size_t _syscallNum;
void *iomap[2];
char *name;
public:
Process();
......@@ -54,6 +55,9 @@ class Process {
void readData(void* dst, uintptr_t address, size_t size) const;
char* readString(uintptr_t address) const;
const char *getName() const;
void setName(const char *name);
void* getPhysicalAddress(uintptr_t ptr) const PURE;
static void print_stacktrace(uintptr_t base = 0, const Process *process = nullptr);
......
......@@ -137,6 +137,7 @@ void ModuleManager::loadStream(Stream *stream) {
delete process;
break;
}
process->setName(mod.name);
if (bindRequirements(mod.requirements, process)) {
process->startup();
} else {
......
......@@ -14,6 +14,7 @@ Process::Process() :
_aslrCode(RAND::get<uintptr_t>(0x80000000llu, 0x100000000llu) << 12),
_aslrStack(RAND::get<uintptr_t>(0x40000000llu, 0x80000000llu) << 12),
_syscallPage(0), _syscallNum(0),
name(nullptr),
pagetable(nullptr) {
iomap[0] = iomap[1] = nullptr;
}
......@@ -64,6 +65,7 @@ Process::~Process() {
ProcessManager::getManager()->dequeueThread(threads[i]);
delete threads[i];
}
delete name;
}
PTE* Process::addPage(uintptr_t vaddr, void* paddr, uint8_t flags) {
......@@ -339,6 +341,12 @@ void Process::exit(int code) {
delete this;
}
const char *Process::getName() const { return name; }
void Process::setName(const char *newname) {
delete name;
name = newname ? klib::strdup(newname) : nullptr;
}
void Process::print_stacktrace(uintptr_t base, const Process *process) {
struct stackframe {
struct stackframe* rbp;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment