diff --git a/headers/build/BeOSBuildCompatibility.h b/headers/build/BeOSBuildCompatibility.h index 87619e71a3..cf1c34c511 100644 --- a/headers/build/BeOSBuildCompatibility.h +++ b/headers/build/BeOSBuildCompatibility.h @@ -26,8 +26,9 @@ # endif #endif -typedef unsigned long haiku_build_addr_t; -#define addr_t haiku_build_addr_t +typedef unsigned long haiku_build_addr_t; +#define addr_t haiku_build_addr_t +#define phys_addr_t haiku_build_addr_t #include diff --git a/headers/build/config_build/HaikuConfig.h b/headers/build/config_build/HaikuConfig.h index e8d7bee211..8d4952210f 100644 --- a/headers/build/config_build/HaikuConfig.h +++ b/headers/build/config_build/HaikuConfig.h @@ -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_ - 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_ - 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 @@ -51,4 +88,5 @@ #define __HAIKU_SUBDIR_ARCH_HEADER(subdir, header) \ + #endif /* _CONFIG_HAIKU_CONFIG_H */ diff --git a/headers/build/config_build/types.h b/headers/build/config_build/types.h index 9a013849b8..02ccf1008c 100644 --- a/headers/build/config_build/types.h +++ b/headers/build/config_build/types.h @@ -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_BUILD_TYPES_H @@ -43,15 +43,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) #endif /* _CONFIG_BUILD_TYPES_H */ diff --git a/headers/build/os/BeBuild.h b/headers/build/os/BeBuild.h index 0a73eb775a..3130e032de 100644 --- a/headers/build/os/BeBuild.h +++ b/headers/build/os/BeBuild.h @@ -1,5 +1,5 @@ /* - * Copyright 2007-2009, Haiku, Inc. All Rights Reserved. + * Copyright 2007-2010, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _BE_BUILD_H @@ -44,8 +44,19 @@ #endif +#define B_HAIKU_BITS __HAIKU_ARCH_BITS +#define B_HAIKU_PHYSICAL_BITS __HAIKU_ARCH_PHYSICAL_BITS + #ifdef __HAIKU_ARCH_64_BIT # define B_HAIKU_64_BIT 1 +#else +# define B_HAIKU_32_BIT 1 +#endif + +#ifdef __HAIKU_ARCH_PHYSICAL_64_BIT +# define B_HAIKU_PHYSICAL_64_BIT 1 +#else +# define B_HAIKU_PHYSICAL_32_BIT 1 #endif #ifdef __HAIKU_BEOS_COMPATIBLE diff --git a/headers/build/os/support/SupportDefs.h b/headers/build/os/support/SupportDefs.h index 95b3bd57df..d9dcb87cf2 100644 --- a/headers/build/os/support/SupportDefs.h +++ b/headers/build/os/support/SupportDefs.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2009, Haiku, Inc. All Rights Reserved. + * Copyright 2004-2010, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Author: @@ -127,6 +127,18 @@ typedef uint32 perform_code; # define B_PRIxADDR B_PRIx32 # define B_PRIXADDR B_PRIX32 #endif +/* phys_addr_t */ +#ifdef HAIKU_HOST_PLATFORM_64_BIT +# define B_PRIuPHYSADDR B_PRIu64 +# define B_PRIoPHYSADDR B_PRIo64 +# define B_PRIxPHYSADDR B_PRIx64 +# define B_PRIXPHYSADDR B_PRIX64 +#else +# define B_PRIuPHYSADDR B_PRIu32 +# define B_PRIoPHYSADDR B_PRIo32 +# define B_PRIxPHYSADDR B_PRIx32 +# define B_PRIXPHYSADDR B_PRIX32 +#endif /* off_t */ #define B_PRIdOFF B_PRId64 #define B_PRIiOFF B_PRIi64 diff --git a/headers/config/HaikuConfig.h b/headers/config/HaikuConfig.h index 1ee10c27cb..306c11294a 100644 --- a/headers/config/HaikuConfig.h +++ b/headers/config/HaikuConfig.h @@ -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_ - 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_ - 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 */ diff --git a/headers/config/types.h b/headers/config/types.h index a66c078901..3b499e4a84 100644 --- a/headers/config/types.h +++ b/headers/config/types.h @@ -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 */ diff --git a/headers/os/BeBuild.h b/headers/os/BeBuild.h index b1c845314f..f55b43d1b4 100644 --- a/headers/os/BeBuild.h +++ b/headers/os/BeBuild.h @@ -46,12 +46,21 @@ #endif +#define B_HAIKU_BITS __HAIKU_ARCH_BITS +#define B_HAIKU_PHYSICAL_BITS __HAIKU_ARCH_PHYSICAL_BITS + #ifdef __HAIKU_ARCH_64_BIT # define B_HAIKU_64_BIT 1 #else # define B_HAIKU_32_BIT 1 #endif +#ifdef __HAIKU_ARCH_PHYSICAL_64_BIT +# define B_HAIKU_PHYSICAL_64_BIT 1 +#else +# define B_HAIKU_PHYSICAL_32_BIT 1 +#endif + #ifdef __HAIKU_BEOS_COMPATIBLE # define B_HAIKU_BEOS_COMPATIBLE 1 #endif diff --git a/headers/os/support/SupportDefs.h b/headers/os/support/SupportDefs.h index 8d97b15eb9..6d06092fe7 100644 --- a/headers/os/support/SupportDefs.h +++ b/headers/os/support/SupportDefs.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2009, Haiku, Inc. All Rights Reserved. + * Copyright 2004-2010, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Author: @@ -118,6 +118,11 @@ typedef uint32 perform_code; #define B_PRIoADDR __HAIKU_PRI_PREFIX_ADDR "o" #define B_PRIxADDR __HAIKU_PRI_PREFIX_ADDR "x" #define B_PRIXADDR __HAIKU_PRI_PREFIX_ADDR "X" +/* phys_addr_t */ +#define B_PRIuPHYSADDR __HAIKU_PRI_PREFIX_PHYS_ADDR "u" +#define B_PRIoPHYSADDR __HAIKU_PRI_PREFIX_PHYS_ADDR "o" +#define B_PRIxPHYSADDR __HAIKU_PRI_PREFIX_PHYS_ADDR "x" +#define B_PRIXPHYSADDR __HAIKU_PRI_PREFIX_PHYS_ADDR "X" /* off_t */ #define B_PRIdOFF B_PRId64 #define B_PRIiOFF B_PRIi64 diff --git a/headers/posix/sys/types.h b/headers/posix/sys/types.h index d5b0ae6b1e..445106bcae 100644 --- a/headers/posix/sys/types.h +++ b/headers/posix/sys/types.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009, Haiku Inc. All Rights Reserved. + * Copyright 2002-2010, Haiku Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_TYPES_H @@ -50,6 +50,7 @@ typedef __haiku_std_int32 nlink_t; typedef char* caddr_t; typedef __haiku_addr_t addr_t; +typedef __haiku_phys_addr_t phys_addr_t; typedef __haiku_int32 key_t; #include diff --git a/headers/private/fs_shell/fssh_api_wrapper.h b/headers/private/fs_shell/fssh_api_wrapper.h index 8ed14328f9..47b960f8c3 100644 --- a/headers/private/fs_shell/fssh_api_wrapper.h +++ b/headers/private/fs_shell/fssh_api_wrapper.h @@ -1493,6 +1493,7 @@ #define ulong fssh_ulong #define addr_t fssh_addr_t +#define phys_addr_t fssh_phys_addr_t #define dev_t fssh_dev_t #define ino_t fssh_ino_t diff --git a/headers/private/fs_shell/fssh_types.h b/headers/private/fs_shell/fssh_types.h index b1718b2b99..019a8a5643 100644 --- a/headers/private/fs_shell/fssh_types.h +++ b/headers/private/fs_shell/fssh_types.h @@ -1,5 +1,5 @@ /* - * Copyright 2007-2009, Ingo Weinhold, bonefish@cs.tu-berlin.de. + * Copyright 2007-2010, Ingo Weinhold, bonefish@cs.tu-berlin.de. * Distributed under the terms of the MIT License. */ #ifndef _FSSH_TYPES_H @@ -15,8 +15,10 @@ typedef volatile int64_t vint64_t; #ifdef HAIKU_HOST_PLATFORM_64_BIT typedef uint64_t fssh_addr_t; +typedef uint64_t fssh_phys_addr_t; #else typedef uint32_t fssh_addr_t; +typedef uint32_t fssh_phys_addr_t; #endif typedef int32_t fssh_dev_t; @@ -114,6 +116,18 @@ typedef int32_t fssh_pid_t; # define FSSH_B_PRIxADDR FSSH_B_PRIx32 # define FSSH_B_PRIXADDR FSSH_B_PRIX32 #endif +/* phys_addr_t */ +#ifdef HAIKU_HOST_PLATFORM_64_BIT +# define FSSH_B_PRIuPHYSADDR FSSH_B_PRIu64 +# define FSSH_B_PRIoPHYSADDR FSSH_B_PRIo64 +# define FSSH_B_PRIxPHYSADDR FSSH_B_PRIx64 +# define FSSH_B_PRIXPHYSADDR FSSH_B_PRIX64 +#else +# define FSSH_B_PRIuPHYSADDR FSSH_B_PRIu32 +# define FSSH_B_PRIoPHYSADDR FSSH_B_PRIo32 +# define FSSH_B_PRIxPHYSADDR FSSH_B_PRIx32 +# define FSSH_B_PRIXPHYSADDR FSSH_B_PRIX32 +#endif /* off_t */ #define FSSH_B_PRIdOFF FSSH_B_PRId64 #define FSSH_B_PRIiOFF FSSH_B_PRIi64