Kernel: you can now ask process if it is userspace process

This commit is contained in:
Bananymous 2023-07-23 18:52:55 +03:00
parent a2bf474013
commit f76d921e25
2 changed files with 4 additions and 0 deletions

View File

@ -114,6 +114,7 @@ namespace Kernel
PageTable& page_table() { return m_page_table ? *m_page_table : PageTable::kernel(); }
bool is_userspace() const { return m_is_userspace; }
const userspace_info_t& userspace_info() const { return m_userspace_info; }
private:
@ -157,6 +158,7 @@ namespace Kernel
vaddr_t m_signal_handlers[_SIGMAX + 1] { };
bool m_is_userspace { false };
userspace_info_t m_userspace_info;
ExitStatus m_exit_status;

View File

@ -58,6 +58,7 @@ namespace Kernel
process->load_elf_to_memory(*elf);
process->m_is_userspace = true;
process->m_userspace_info.entry = elf->file_header_native().e_entry;
// NOTE: we clear the elf since we don't need the memory anymore
@ -305,6 +306,7 @@ namespace Kernel
forked->m_mapped_ranges = BAN::move(mapped_ranges);
forked->m_fixed_width_allocators = BAN::move(fixed_width_allocators);
forked->m_general_allocator = BAN::move(general_allocator);
forked->m_is_userspace = m_is_userspace;
forked->m_userspace_info = m_userspace_info;
memcpy(forked->m_signal_handlers, m_signal_handlers, sizeof(m_signal_handlers));