* config/{HaikuConfig.h,types.h}:
- Added macro __HAIKU_ARCH_BITS specifying the architecture bitness (32/64)
(might be more convenient to use than __HAIKU_ARCH_{32,64}_BIT).
- Added macros __HAIKU_ARCH_PHYSICAL_BITS, __HAIKU_ARCH_PHYSICAL_{32,64}_BIT,
and the types __haiku_phys_[s]addr_t. The intention is to use separate
macros and types for virtual and physical addresses, since for some
architectures (e.g. x86 with PAE) those actually differ.
* sys/types.h, BeBuild.h, SupportDefs.h:
- Added types phys_[s]addr_t and respective printf() format macros.
- Added public macros B_HAIKU_BITS, B_HAIKU_PHYSICAL_BITS,
B_HAIKU_PHYSICAL_{32,64}_BIT.
Might break the build under older Haiku installations. Will test next.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36926 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2009, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2009-2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _CONFIG_HAIKU_CONFIG_H
|
||||
@@ -8,18 +8,22 @@
|
||||
|
||||
/* Determine the architecture and define macros for some fundamental
|
||||
properties:
|
||||
__HAIKU_ARCH - short name of the architecture (used in paths)
|
||||
__HAIKU_ARCH_<arch> - defined to 1 for the respective architecture
|
||||
__HAIKU_ARCH_64_BIT - defined to 1 on 64 bit architectures
|
||||
__HAIKU_BIG_ENDIAN - defined to 1 on big endian architectures
|
||||
__HAIKU_ARCH - short name of the architecture (used in paths)
|
||||
__HAIKU_ARCH_<arch> - defined to 1 for the respective architecture
|
||||
__HAIKU_ARCH_BITS - defined to 32/64 on 32/64 bit architectures
|
||||
(defaults to 32)
|
||||
__HAIKU_ARCH_PHYSICAL_BITS - defined to 32/64 on architectures with 32/64
|
||||
(defaults to __HAIKU_ARCH_BITS)
|
||||
__HAIKU_BIG_ENDIAN - defined to 1 on big endian architectures
|
||||
(defaults to undefined)
|
||||
*/
|
||||
#ifdef __INTEL__
|
||||
# define __HAIKU_ARCH x86
|
||||
# define __HAIKU_ARCH_X86 1
|
||||
# define __HAIKU_ARCH x86
|
||||
# define __HAIKU_ARCH_X86 1
|
||||
#elif __x86_64__
|
||||
# define __HAIKU_ARCH x86_64
|
||||
# define __HAIKU_ARCH_X86_64 1
|
||||
# define __HAIKU_ARCH_64_BIT 1
|
||||
# define __HAIKU_ARCH x86_64
|
||||
# define __HAIKU_ARCH_X86_64 1
|
||||
# define __HAIKU_ARCH_BITS 64
|
||||
#elif __POWERPC__
|
||||
# define __HAIKU_ARCH ppc
|
||||
# define __HAIKU_ARCH_PPC 1
|
||||
@@ -38,10 +42,43 @@
|
||||
# error Unsupported architecture!
|
||||
#endif
|
||||
|
||||
/* implied properties */
|
||||
#ifndef __HAIKU_ARCH_64_BIT
|
||||
# define __HAIKU_ARCH_32_BIT 1
|
||||
/* implied properties:
|
||||
__HAIKU_ARCH_{32,64}_BIT - defined to 1 on 32/64 bit architectures, i.e.
|
||||
using 32/64 bit virtual addresses
|
||||
__HAIKU_ARCH_PHYSICAL_BITS - defined to 32/64 on architectures with 32/64
|
||||
bit physical addresses
|
||||
__HAIKU_ARCH_PHYSICAL_{32,64}_BIT - defined to 1 on architectures using 64
|
||||
bit physical addresses
|
||||
__HAIKU_BIG_ENDIAN - defined to 1 on big endian architectures
|
||||
*/
|
||||
|
||||
/* bitness */
|
||||
#ifndef __HAIKU_ARCH_BITS
|
||||
# define __HAIKU_ARCH_BITS 32
|
||||
#endif
|
||||
|
||||
#if __HAIKU_ARCH_BITS == 32
|
||||
# define __HAIKU_ARCH_32_BIT 1
|
||||
#elif __HAIKU_ARCH_BITS == 64
|
||||
# define __HAIKU_ARCH_64_BIT 1
|
||||
#else
|
||||
# error Unsupported bitness!
|
||||
#endif
|
||||
|
||||
/* physical bitness */
|
||||
#ifndef __HAIKU_ARCH_PHYSICAL_BITS
|
||||
# define __HAIKU_ARCH_PHYSICAL_BITS __HAIKU_ARCH_BITS
|
||||
#endif
|
||||
|
||||
#if __HAIKU_ARCH_PHYSICAL_BITS == 32
|
||||
# define __HAIKU_ARCH_PHYSICAL_32_BIT 1
|
||||
#elif __HAIKU_ARCH_PHYSICAL_BITS == 64
|
||||
# define __HAIKU_ARCH_PHYSICAL_64_BIT 1
|
||||
#else
|
||||
# error Unsupported physical bitness!
|
||||
#endif
|
||||
|
||||
/* endianess */
|
||||
#ifndef __HAIKU_BIG_ENDIAN
|
||||
# define __HAIKU_LITTLE_ENDIAN 1
|
||||
#endif
|
||||
@@ -66,4 +103,5 @@
|
||||
# define __HAIKU_BEOS_COMPATIBLE_TYPES 1
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _CONFIG_HAIKU_CONFIG_H */
|
||||
|
||||
+29
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2009, Haiku, Inc. All Rights Reserved.
|
||||
* Copyright 2009-2010, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _CONFIG_TYPES_H
|
||||
@@ -46,15 +46,32 @@ typedef __haiku_std_uint64 __haiku_uint64;
|
||||
typedef __haiku_uint32 __haiku_addr_t;
|
||||
#endif
|
||||
|
||||
#ifdef __HAIKU_ARCH_PHYSICAL_64_BIT
|
||||
typedef __haiku_int64 __haiku_phys_saddr_t;
|
||||
typedef __haiku_uint64 __haiku_phys_addr_t;
|
||||
#else
|
||||
typedef __haiku_int32 __haiku_phys_saddr_t;
|
||||
typedef __haiku_uint32 __haiku_phys_addr_t;
|
||||
#endif
|
||||
|
||||
/* address type limits */
|
||||
#ifdef __HAIKU_ARCH_64_BIT
|
||||
# define __HAIKU_SADDR_MAX (9223372036854775807LL)
|
||||
# define __HAIKU_ADDR_MAX (18446744073709551615ULL)
|
||||
# define __HAIKU_SADDR_MAX (9223372036854775807LL)
|
||||
# define __HAIKU_ADDR_MAX (18446744073709551615ULL)
|
||||
#else
|
||||
# define __HAIKU_SADDR_MAX (2147483647)
|
||||
# define __HAIKU_ADDR_MAX (4294967295U)
|
||||
# define __HAIKU_SADDR_MAX (2147483647)
|
||||
# define __HAIKU_ADDR_MAX (4294967295U)
|
||||
#endif
|
||||
#define __HAIKU_SADDR_MIN (-__HAIKU_SADDR_MAX-1)
|
||||
#define __HAIKU_SADDR_MIN (-__HAIKU_SADDR_MAX-1)
|
||||
|
||||
#ifdef __HAIKU_ARCH_PHYSICAL_64_BIT
|
||||
# define __HAIKU_PHYS_SADDR_MAX (9223372036854775807LL)
|
||||
# define __HAIKU_PHYS_ADDR_MAX (18446744073709551615ULL)
|
||||
#else
|
||||
# define __HAIKU_PHYS_SADDR_MAX (2147483647)
|
||||
# define __HAIKU_PHYS_ADDR_MAX (4294967295U)
|
||||
#endif
|
||||
#define __HAIKU_PHYS_SADDR_MIN (-__HAIKU_SADDR_MAX-1)
|
||||
|
||||
|
||||
/* printf()/scanf() format prefixes */
|
||||
@@ -74,5 +91,11 @@ typedef __haiku_std_uint64 __haiku_uint64;
|
||||
# define __HAIKU_PRI_PREFIX_ADDR __HAIKU_PRI_PREFIX_32
|
||||
#endif
|
||||
|
||||
#ifdef __HAIKU_ARCH_PHYSICAL_64_BIT
|
||||
# define __HAIKU_PRI_PREFIX_PHYS_ADDR __HAIKU_PRI_PREFIX_64
|
||||
#else
|
||||
# define __HAIKU_PRI_PREFIX_PHYS_ADDR __HAIKU_PRI_PREFIX_32
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _CONFIG_TYPES_H */
|
||||
|
||||
Reference in New Issue
Block a user