-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocess.h
44 lines (33 loc) · 1007 Bytes
/
process.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once
#include "elf_object.h"
#include <filesystem>
#include <iostream>
#include <string>
#include <set>
#include <vector>
class Process
{
public:
Process()
{
search_paths_.emplace_back("/usr/lib/x86_64-linux-gnu/");
}
int run()
{
using Fun = int(*)(void);
void * entry = objects_[0].entry_point();
Fun f = (Fun)(entry);
printf("Jumping to entry %p ...\n", (void*)(entry));
int ret = f();
printf("After jump\n");
return ret;
}
int load_object_and_dependencies(std::filesystem::path path);
int load_object(std::filesystem::path path);
int adjust_permissions();
int apply_relocations();
friend std::ostream& operator<<(std::ostream& os, const Process& process);
// private:
std::vector<ElfObject> objects_;
std::vector<std::filesystem::path> search_paths_;
};