summaryrefslogtreecommitdiffhomepage
path: root/Kernel/ArchKit/ArchKit.hpp
blob: 837702723f96ce58d8d6591fa72070cda0f75602 (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
/* -------------------------------------------

	Copyright SoftwareLabs

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

#pragma once

#include <NewKit/Array.hpp>
#include <NewKit/Defines.hpp>
#include <NewKit/Function.hpp>

#ifdef __NEWOS_AMD64__
#include <HALKit/AMD64/HalPageAlloc.hpp>
#include <HALKit/AMD64/Hypervisor.hpp>
#include <HALKit/AMD64/Processor.hpp>
#elif defined(__NEWOS_PPC__)
#include <HALKit/POWER/Processor.hpp>
#else
#error Unknown architecture
#endif

namespace NewOS
{
	constexpr static inline SSizeT rt_hash_seed(const char* seed, int mul)
	{
		SSizeT hash = 0;

		for (SSizeT idx = 0; seed[idx] != 0; ++idx)
		{
			hash += seed[idx];
			hash ^= mul;
		}

		return hash;
	}
} // namespace NewOS

#define kKernelMaxSystemCalls (256)

typedef NewOS::Void (*rt_syscall_proc)(NewOS::HAL::StackFramePtr);

extern NewOS::Array<rt_syscall_proc,
					kKernelMaxSystemCalls>
	kSyscalls;

EXTERN_C NewOS::HAL::StackFramePtr rt_get_current_context();
EXTERN_C NewOS::Void rt_do_context_switch(NewOS::HAL::StackFramePtr stackFrame);

#include <FirmwareKit/Handover.hxx>