summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/HALKit/AMD64/HalSchedulerCorePrimitivesAMD64.cc
blob: b6ea7ca3b0225ba11b089bd5f4bbef9889d8ba5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* -------------------------------------------

	Copyright (C) 2024, Amlal EL Mahrouss, all rights reserved.

------------------------------------------- */

#include <HALKit/AMD64/Processor.h>
#include <KernelKit/UserProcessScheduler.h>

namespace Kernel
{
	/***********************************************************************************/
	/// @brief Unimplemented function (crashes by default)
	/// @param
	/***********************************************************************************/

	EXTERN_C Void __zka_pure_call(UserProcess* process)
	{
		if (process)
			process->Crash();
	}

	/***********************************************************************************/
	/// @brief Validate user stack.
	/// @param stack_ptr the frame pointer.
	/***********************************************************************************/

	EXTERN_C Bool hal_check_stack(HAL::StackFramePtr stack_ptr)
	{
		if (!stack_ptr)
			return No;

		return stack_ptr->SP != 0 && stack_ptr->BP != 0;
	}

	/// @brief Wakes up thread.
	/// Wakes up thread from the hang state.
	Void mp_wakeup_thread(HAL::StackFrame* stack)
	{
		Kernel::UserProcessHelper::StartScheduling();
	}

	/// @brief makes the thread sleep on a loop.
	/// hooks and hangs thread to prevent code from executing.
	Void mp_hang_thread(HAL::StackFrame* stack)
	{
		while (Yes)
		{
			/* Nothing to do, code is spinning */
		}
	}
} // namespace Kernel