@@ -19,8 +19,7 @@ namespace Kernel {
1919READONLY_AFTER_INIT FPUState s_clean_fpu_state;
2020READONLY_AFTER_INIT Atomic<u32 > g_total_processors;
2121
22- template <typename T>
23- void ProcessorBase<T>::check_invoke_scheduler()
22+ void ProcessorBase::check_invoke_scheduler ()
2423{
2524 VERIFY_INTERRUPTS_DISABLED ();
2625 VERIFY (!m_in_irq);
@@ -31,10 +30,8 @@ void ProcessorBase<T>::check_invoke_scheduler()
3130 Scheduler::invoke_async ();
3231 }
3332}
34- template void ProcessorBase<Processor>::check_invoke_scheduler();
3533
36- template <typename T>
37- void ProcessorBase<T>::deferred_call_queue(Function<void ()> callback)
34+ void ProcessorBase::deferred_call_queue (Function<void ()> callback)
3835{
3936 // NOTE: If we are called outside of a critical section and outside
4037 // of an irq handler, the function will be executed before we return!
@@ -46,10 +43,8 @@ void ProcessorBase<T>::deferred_call_queue(Function<void()> callback)
4643
4744 cur_proc.m_deferred_call_pool .queue_entry (entry);
4845}
49- template void ProcessorBase<Processor>::deferred_call_queue(Function<void ()>);
5046
51- template <typename T>
52- void ProcessorBase<T>::enter_trap(TrapFrame& trap, bool raise_irq)
47+ void ProcessorBase::enter_trap (TrapFrame& trap, bool raise_irq)
5348{
5449 VERIFY_INTERRUPTS_DISABLED ();
5550 VERIFY (&Processor::current () == this );
@@ -72,25 +67,32 @@ void ProcessorBase<T>::enter_trap(TrapFrame& trap, bool raise_irq)
7267 trap.next_trap = nullptr ;
7368 }
7469}
75- template void ProcessorBase<Processor>::enter_trap(TrapFrame&, bool );
7670
77- template <typename T>
78- u64 ProcessorBase<T>::time_spent_idle() const
71+ InterruptsState ProcessorBase::interrupts_state ()
72+ {
73+ return ProcessorBase::are_interrupts_enabled () ? InterruptsState::Enabled : InterruptsState::Disabled;
74+ }
75+
76+ void ProcessorBase::restore_interrupts_state (InterruptsState interrupts_state)
77+ {
78+ if (interrupts_state == InterruptsState::Enabled)
79+ ProcessorBase::enable_interrupts ();
80+ else
81+ ProcessorBase::disable_interrupts ();
82+ }
83+
84+ u64 ProcessorBase::time_spent_idle () const
7985{
8086 return m_idle_thread->time_in_user () + m_idle_thread->time_in_kernel ();
8187}
82- template u64 ProcessorBase<Processor>::time_spent_idle() const ;
8388
84- template <typename T>
85- void ProcessorBase<T>::leave_critical()
89+ void ProcessorBase::leave_critical ()
8690{
8791 InterruptDisabler disabler;
8892 current ().do_leave_critical ();
8993}
90- template void ProcessorBase<Processor>::leave_critical();
9194
92- template <typename T>
93- void ProcessorBase<T>::do_leave_critical()
95+ void ProcessorBase::do_leave_critical ()
9496{
9597 VERIFY (m_in_critical > 0 );
9698 if (m_in_critical == 1 ) {
@@ -105,7 +107,6 @@ void ProcessorBase<T>::do_leave_critical()
105107 m_in_critical = m_in_critical - 1 ;
106108 }
107109}
108- template void ProcessorBase<Processor>::do_leave_critical();
109110
110111void exit_kernel_thread (void )
111112{
@@ -135,8 +136,7 @@ void do_context_first_init(Thread* from_thread, Thread* to_thread)
135136 Scheduler::leave_on_first_switch (InterruptsState::Disabled);
136137}
137138
138- template <typename T>
139- ErrorOr<Vector<FlatPtr, 32 >> ProcessorBase<T>::capture_stack_trace(Thread& thread, size_t max_frames)
139+ ErrorOr<Vector<FlatPtr, 32 >> ProcessorBase::capture_stack_trace (Thread& thread, size_t max_frames)
140140{
141141 FlatPtr frame_ptr = 0 , pc = 0 ;
142142 Vector<FlatPtr, 32 > stack_trace;
@@ -264,6 +264,5 @@ ErrorOr<Vector<FlatPtr, 32>> ProcessorBase<T>::capture_stack_trace(Thread& threa
264264
265265 return stack_trace;
266266}
267- template ErrorOr<Vector<FlatPtr, 32 >> ProcessorBase<Processor>::capture_stack_trace(Thread&, size_t );
268267
269268}
0 commit comments