1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

Kernel: Implement software context switching and Processor structure

Moving certain globals into a new Processor structure for
each CPU allows us to eventually run an instance of the
scheduler on each CPU.
This commit is contained in:
Tom 2020-06-27 13:42:28 -06:00 committed by Andreas Kling
parent 10407061d2
commit fb41d89384
Notes: sideshowbarker 2024-07-19 05:18:13 +09:00
22 changed files with 1002 additions and 513 deletions

View file

@ -77,7 +77,6 @@ public:
~Thread();
static Thread* from_tid(int);
static void initialize();
static void finalize_dying_threads();
static Vector<Thread*> all_threads();
@ -287,6 +286,7 @@ public:
u32 ticks() const { return m_ticks; }
VirtualAddress thread_specific_data() const { return m_thread_specific_data; }
size_t thread_specific_region_size() const { return m_thread_specific_region_size; }
u64 sleep(u32 ticks);
u64 sleep_until(u64 wakeup_time);
@ -354,6 +354,9 @@ public:
void set_selector(u16 s) { m_far_ptr.selector = s; }
void set_state(State);
bool is_initialized() const { return m_initialized; }
void set_initialized(bool initialized) { m_initialized = initialized; }
void send_urgent_signal_to_self(u8 signal);
void send_signal(u8 signal, Process* sender);
void consider_unblock(time_t now_sec, long now_usec);
@ -472,6 +475,7 @@ private:
u32 m_kernel_stack_top { 0 };
OwnPtr<Region> m_kernel_stack_region;
VirtualAddress m_thread_specific_data;
size_t m_thread_specific_region_size { 0 };
SignalActionData m_signal_action_data[32];
Blocker* m_blocker { nullptr };
@ -506,9 +510,11 @@ private:
bool m_dump_backtrace_on_finalization { false };
bool m_should_die { false };
bool m_initialized {false};
OwnPtr<ThreadTracer> m_tracer;
void notify_finalizer();
void yield_without_holding_big_lock();
};
@ -595,7 +601,4 @@ inline IterationDecision Scheduler::for_each_nonrunnable(Callback callback)
return IterationDecision::Continue;
}
u16 thread_specific_selector();
Descriptor& thread_specific_descriptor();
}