Luna/kernel/src/thread/ThreadImage.h

37 lines
865 B
C
Raw Normal View History

#pragma once
#include "arch/CPU.h"
#include "arch/MMU.h"
#include "binfmt/BinaryFormat.h"
#include "fs/VFS.h"
#include "memory/AddressSpace.h"
2023-03-18 22:45:48 +00:00
#include "thread/Thread.h"
#include <luna/LinkedList.h>
#include <luna/OwnedPtr.h>
#include <luna/Result.h>
#include <luna/Stack.h>
2023-04-07 12:37:06 +00:00
#include <luna/String.h>
#include <luna/Vector.h>
class Thread;
class ThreadImage
{
public:
static Result<OwnedPtr<ThreadImage>> try_load_from_binary(SharedPtr<BinaryFormatLoader> inode);
2023-03-18 22:45:48 +00:00
static Result<OwnedPtr<ThreadImage>> clone_from_thread(Thread* parent);
2023-03-18 21:25:19 +00:00
Result<u64> push_mem_on_stack(const u8* mem, usize size);
Result<u64> push_string_vector_on_stack(const Vector<String>& vec);
2023-03-18 21:25:19 +00:00
void apply(Thread* thread);
private:
OwnedPtr<AddressSpace> m_address_space;
Stack m_user_stack;
Stack m_kernel_stack;
u64 m_program_entry;
2023-03-18 21:25:19 +00:00
u64 m_sp;
};