mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-24 03:11:53 +00:00
Kernel/LibCore: Expose processor id where a thread last ran
This commit is contained in:
parent
d98edb3171
commit
d99901660d
Notes:
sideshowbarker
2024-07-19 05:18:06 +09:00
Author: https://github.com/tomuta
Commit: d99901660d
Pull-request: https://github.com/SerenityOS/serenity/pull/2513
5 changed files with 11 additions and 1 deletions
|
@ -904,13 +904,16 @@ extern "C" void enter_thread_context(Thread* from_thread, Thread* to_thread)
|
|||
set_fs(to_tss.fs);
|
||||
set_gs(to_tss.gs);
|
||||
|
||||
auto& tls_descriptor = Processor::current().get_gdt_entry(GDT_SELECTOR_TLS);
|
||||
auto& processor = Processor::current();
|
||||
auto& tls_descriptor = processor.get_gdt_entry(GDT_SELECTOR_TLS);
|
||||
tls_descriptor.set_base(to_thread->thread_specific_data().as_ptr());
|
||||
tls_descriptor.set_limit(to_thread->thread_specific_region_size());
|
||||
|
||||
if (from_tss.cr3 != to_tss.cr3)
|
||||
write_cr3(to_tss.cr3);
|
||||
|
||||
to_thread->set_cpu(processor.id());
|
||||
|
||||
asm volatile("fxrstor %0"
|
||||
::"m"(to_thread->fpu_state()));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue