Add a kernel ELF module and load it in a new process.
Don't yet jump to userspace.
This commit is contained in:
parent
f86bbe6ea9
commit
aefb4f082b
22 changed files with 223 additions and 16 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#include "scheduler/thread.h"
|
||||
|
||||
#include "debug/debug.h"
|
||||
#include "loader/elf_loader.h"
|
||||
#include "scheduler/process.h"
|
||||
#include "scheduler/scheduler.h"
|
||||
|
||||
|
|
@ -16,7 +17,8 @@ extern "C" void thread_init() {
|
|||
|
||||
Thread* Thread::RootThread(Process* root_proc) { return new Thread(root_proc); }
|
||||
|
||||
Thread::Thread(Process* proc, uint64_t tid) : process_(proc), id_(tid) {
|
||||
Thread::Thread(Process* proc, uint64_t tid, uint64_t elf_ptr)
|
||||
: process_(proc), id_(tid), elf_ptr_(elf_ptr) {
|
||||
uint64_t* stack = new uint64_t[512];
|
||||
uint64_t* stack_ptr = stack + 511;
|
||||
// 0: rip
|
||||
|
|
@ -34,6 +36,7 @@ Thread::Thread(Process* proc, uint64_t tid) : process_(proc), id_(tid) {
|
|||
uint64_t Thread::pid() { return process_->id(); }
|
||||
|
||||
void Thread::Init() {
|
||||
LoadElfProgram(elf_ptr_, 0);
|
||||
while (true) {
|
||||
dbgln("[%u.%u]", pid(), id_);
|
||||
sched::Yield();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue