mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 20:33:10 +00:00
Kernel: Add ThreadRegisters::set_exec_state and use it in execve.cpp
Using this abstraction it is possible to compile this file for aarch64.
This commit is contained in:
parent
171a8ca478
commit
1fbf562e7e
|
@ -33,6 +33,14 @@ struct ThreadRegisters {
|
||||||
set_ip(entry_ip);
|
set_ip(entry_ip);
|
||||||
x[0] = entry_data;
|
x[0] = entry_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_exec_state(FlatPtr entry_ip, FlatPtr userspace_sp, Memory::AddressSpace& space)
|
||||||
|
{
|
||||||
|
(void)entry_ip;
|
||||||
|
(void)userspace_sp;
|
||||||
|
(void)space;
|
||||||
|
TODO_AARCH64();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,14 @@ struct ThreadRegisters {
|
||||||
set_ip(entry_ip);
|
set_ip(entry_ip);
|
||||||
rdi = entry_data; // entry function argument is expected to be in regs.rdi
|
rdi = entry_data; // entry function argument is expected to be in regs.rdi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_exec_state(FlatPtr entry_ip, FlatPtr userspace_sp, Memory::AddressSpace& space)
|
||||||
|
{
|
||||||
|
cs = GDT_SELECTOR_CODE3 | 3;
|
||||||
|
rip = entry_ip;
|
||||||
|
rsp = userspace_sp;
|
||||||
|
cr3 = space.page_directory().cr3();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -685,10 +685,9 @@ ErrorOr<void> Process::do_exec(NonnullLockRefPtr<OpenFileDescription> main_progr
|
||||||
new_main_thread->reset_fpu_state();
|
new_main_thread->reset_fpu_state();
|
||||||
|
|
||||||
auto& regs = new_main_thread->m_regs;
|
auto& regs = new_main_thread->m_regs;
|
||||||
regs.cs = GDT_SELECTOR_CODE3 | 3;
|
address_space().with([&](auto& space) {
|
||||||
regs.rip = load_result.entry_eip;
|
regs.set_exec_state(load_result.entry_eip, new_userspace_sp, *space);
|
||||||
regs.rsp = new_userspace_sp;
|
});
|
||||||
regs.cr3 = address_space().with([](auto& space) { return space->page_directory().cr3(); });
|
|
||||||
|
|
||||||
{
|
{
|
||||||
TemporaryChange profiling_disabler(m_profiling, was_profiling);
|
TemporaryChange profiling_disabler(m_profiling, was_profiling);
|
||||||
|
|
Loading…
Reference in a new issue