summaryrefslogtreecommitdiff
path: root/kernel_call/platform.h
blob: 87ab62eaf0a9b28b363361f5890c17e6836ceac9 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
 * platform.h
 * Brandon Azad
 */
#ifndef VOUCHER_SWAP__PLATFORM_H_
#define VOUCHER_SWAP__PLATFORM_H_

#include <stdbool.h>
#include <mach/machine.h>

#ifdef PLATFORM_EXTERN
#define extern PLATFORM_EXTERN
#endif

/*
 * platform
 *
 * Description:
 * 	Basic information about the platform.
 */
struct platform {
	/*
	 * platform.machine
	 *
	 * Description:
	 * 	The name of the platform, e.g. iPhone11,8.
	 */
	const char machine[32];
	/*
	 * platform.osversion
	 *
	 * Description:
	 * 	The version of the OS build, e.g. 16C50.
	 */
	const char osversion[32];
	/*
	 * platform.cpu_type
	 *
	 * Description:
	 * 	The platform CPU type.
	 */
	cpu_type_t cpu_type;
	/*
	 * platform.cpu_subtype
	 *
	 * Description:
	 * 	The platform CPU subtype.
	 */
	cpu_subtype_t cpu_subtype;
	/*
	 * platform.physical_cpu
	 *
	 * Description:
	 * 	The number of physical CPU cores.
	 */
	unsigned physical_cpu;
	/*
	 * platform.logical_cpu
	 *
	 * Description:
	 * 	The number of logical CPU cores.
	 */
	unsigned logical_cpu;
	/*
	 * platform.page_size
	 *
	 * Description:
	 * 	The kernel page size.
	 */
	size_t page_size;
	/*
	 * platform.memory_size
	 *
	 * Description:
	 * 	The size of physical memory on the device.
	 */
	size_t memory_size;
};
extern struct platform platform;

/*
 * page_size
 *
 * Description:
 * 	The kernel page size on this platform, made available globally for convenience.
 */
extern size_t page_size;

/*
 * platform_init
 *
 * Description:
 * 	Initialize the platform.
 */
void platform_init(void);

#undef extern

#endif