The Pedigree Project  0.1
system/include/pedigree/kernel/processor/types.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_TYPES_H
21 #define KERNEL_PROCESSOR_TYPES_H
22 
23 #if defined(X86)
24 #include "pedigree/kernel/processor/x86/types.h" // IWYU pragma: export
25 #define PROCESSOR_SPECIFIC_NAME(x) X86##x
26 #elif defined(X64)
27 #include "pedigree/kernel/processor/x64/types.h" // IWYU pragma: export
28 #define PROCESSOR_SPECIFIC_NAME(x) X64##x
29 #elif defined(MIPS32)
30 #include "pedigree/kernel/processor/mips32/types.h" // IWYU pragma: export
31 #define PROCESSOR_SPECIFIC_NAME(x) MIPS32##x
32 #elif defined(MIPS64)
33 #include "pedigree/kernel/processor/mips64/types.h" // IWYU pragma: export
34 #define PROCESSOR_SPECIFIC_NAME(x) MIPS64##x
35 #elif defined(ARM_COMMON)
36 #include "pedigree/kernel/processor/arm_common/types.h" // IWYU pragma: export
37 #define PROCESSOR_SPECIFIC_NAME(x) ARM##x
38 #elif defined(PPC32)
39 #include "pedigree/kernel/processor/ppc32/types.h" // IWYU pragma: export
40 #define PROCESSOR_SPECIFIC_NAME(x) PPC32##x
41 #elif defined(HOSTED)
42 #include "pedigree/kernel/processor/hosted/types.h" // IWYU pragma: export
43 #define PROCESSOR_SPECIFIC_NAME(x) HOSTED##x
44 #endif
45 
46 // NOTE: This throws a compile-time error if this header is not adapted for
47 // the selected processor architecture
48 #if !defined(PROCESSOR_SPECIFIC_NAME)
49 #error Unknown processor architecture
50 #endif
51 
55 // NOTE: If a newly added processor architecture does not supply all the
56 // needed types, you will get an error here
57 
59 typedef PROCESSOR_SPECIFIC_NAME(int8_t) int8_t;
61 typedef PROCESSOR_SPECIFIC_NAME(uint8_t) uint8_t;
63 typedef PROCESSOR_SPECIFIC_NAME(int16_t) int16_t;
65 typedef PROCESSOR_SPECIFIC_NAME(uint16_t) uint16_t;
67 typedef PROCESSOR_SPECIFIC_NAME(int32_t) int32_t;
69 typedef PROCESSOR_SPECIFIC_NAME(uint32_t) uint32_t;
71 typedef PROCESSOR_SPECIFIC_NAME(int64_t) int64_t;
73 typedef PROCESSOR_SPECIFIC_NAME(uint64_t) uint64_t;
74 
76 typedef PROCESSOR_SPECIFIC_NAME(intptr_t) intptr_t;
78 typedef PROCESSOR_SPECIFIC_NAME(uintptr_t) uintptr_t;
79 
81 typedef PROCESSOR_SPECIFIC_NAME(physical_uintptr_t) physical_uintptr_t;
82 
84 typedef PROCESSOR_SPECIFIC_NAME(processor_register_t) processor_register_t;
85 
87 #ifndef _SSIZE_T_DEFINED
88 #define _SSIZE_T_DEFINED
89 typedef PROCESSOR_SPECIFIC_NAME(ssize_t) ssize_t;
90 #endif
91 
92 #ifndef _SIZE_T_DEFINED
93 #define _SIZE_T_DEFINED
94 typedef PROCESSOR_SPECIFIC_NAME(size_t) size_t;
95 #endif
96 
97 // NOTE: This should be defined in the file included at the top of this file
98 // if this processor architecture does not support I/O ports
99 #if !defined(KERNEL_PROCESSOR_NO_PORT_IO)
100 
101 typedef PROCESSOR_SPECIFIC_NAME(io_port_t) io_port_t;
102 #endif
103 
104 #if !defined(PAGE_SIZE)
105 #error PAGE_SIZE not defined
106 #endif
107 
110 #undef PROCESSOR_SPECIFIC_NAME
111 
112 #endif
typedef PROCESSOR_SPECIFIC_NAME(int8_t) int8_t