The Pedigree Project  0.1
ProcessorInformation.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef KERNEL_PROCESSOR_PROCESSORINFORMATION_H
21 #define KERNEL_PROCESSOR_PROCESSORINFORMATION_H
22 
23 #include "pedigree/kernel/processor/types.h"
24 
29 typedef size_t ProcessorId;
30 
33 #ifndef _PROCESSOR_INFORMATION_ONLY_WANT_PROCESSORID
34 
35 #if defined(X86_COMMON)
36 #include "pedigree/kernel/processor/x86_common/ProcessorInformation.h" // IWYU pragma: export
37 #define PROCESSOR_SPECIFIC_NAME(x) X86Common##x
38 #elif defined(MIPS_COMMON)
39 #include "pedigree/kernel/processor/mips_common/ProcessorInformation.h" // IWYU pragma: export
40 #define PROCESSOR_SPECIFIC_NAME(x) MIPSCommon##x
41 #elif defined(ARM_COMMON)
42 #include "pedigree/kernel/processor/arm_common/ProcessorInformation.h" // IWYU pragma: export
43 #define PROCESSOR_SPECIFIC_NAME(x) ArmCommon##x
44 #elif defined(PPC_COMMON)
45 #include "pedigree/kernel/processor/ppc_common/ProcessorInformation.h" // IWYU pragma: export
46 #define PROCESSOR_SPECIFIC_NAME(x) PPCCommon##x
47 #elif defined(HOSTED)
48 #include "pedigree/kernel/processor/hosted/ProcessorInformation.h" // IWYU pragma: export
49 #define PROCESSOR_SPECIFIC_NAME(x) Hosted##x
50 #endif
51 
52 // NOTE: This throws a compile-time error if this header is not adapted for
53 // the selected processor architecture
54 #if !defined(PROCESSOR_SPECIFIC_NAME)
55 #error Unknown processor architecture
56 #endif
57 
61 // NOTE: If a newly added processor architecture does not supply all the
62 // needed types, you will get an error here
63 
65 typedef PROCESSOR_SPECIFIC_NAME(ProcessorInformation) ProcessorInformation;
66 
69 #undef PROCESSOR_SPECIFIC_NAME
70 
71 #else
72 #undef KERNEL_PROCESSOR_PROCESSORINFORMATION_H
73 #endif
74 
75 #endif
size_t ProcessorId
typedef PROCESSOR_SPECIFIC_NAME(ProcessorInformation) ProcessorInformation