Index: build/qnx.qcc.inc =================================================================== --- build/qnx.qcc.inc (revision 0) +++ build/qnx.qcc.inc (revision 0) @@ -0,0 +1,103 @@ +# Copyright 2005-2008 Intel Corporation. All Rights Reserved. +# +# This file is part of Threading Building Blocks. +# +# Threading Building Blocks is free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public License +# version 2 as published by the Free Software Foundation. +# +# Threading Building Blocks is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied warranty +# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Threading Building Blocks; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# As a special exception, you may use this file as part of a free software +# library without restriction. Specifically, if other files instantiate +# templates or use macros or inline functions from this file, or you compile +# this file and link it with other files to produce an executable, this +# file does not by itself cause the resulting executable to be covered by +# the GNU General Public License. This exception does not however +# invalidate any other reasons why the executable file might be covered by +# the GNU General Public License. + +COMPILE_ONLY = -Vgcc_ntox86_cpp -c +PREPROC_ONLY = -E -lang-c +INCLUDE_KEY = -I +DEFINE_KEY = -D +OUTPUT_KEY = -o # +OUTPUTOBJ_KEY = -o # +PIC_KEY = -fPIC +WARNING_AS_ERROR_KEY = -Wc,-Werror +WARNING_KEY = -Wc,-Wall +WARNING_SUPPRESS = -Wc,-Wno-parentheses +DYLIB_KEY = -shared +#LIBDL = -ldl +LIBDL = + +TBB_NOSTRICT = 1 + +CPLUS = QCC +CPLUS_FLAGS += -fexceptions +LIB_LINK_FLAGS = -shared -Wl,-soname=$(BUILDING_LIBRARY) +#LIBS = -lpthread -lrt +LIBS = +C_FLAGS = $(CPLUS_FLAGS) -lang-c + +ifeq ($(cfg), release) + CPLUS_FLAGS = -DDO_ITT_NOTIFY -O2 -DUSE_PTHREAD +endif +ifeq ($(cfg), debug) + CPLUS_FLAGS = -DTBB_DO_ASSERT -DDO_ITT_NOTIFY -g -O0 -DUSE_PTHREAD +endif + +ASM= +ASM_FLAGS= + +TBB_ASM.OBJ= + +ifeq (itanium,$(arch)) +# Position-independent code (PIC) is a must on IA-64, even for regular (not shared) executables + CPLUS_FLAGS += $(PIC_KEY) +endif + +ifeq (em64t,$(arch)) + CPLUS_FLAGS += -m64 + LIB_LINK_FLAGS += -m64 +endif + +ifeq (ia32,$(arch)) + CPLUS_FLAGS += -m32 + LIB_LINK_FLAGS += -m32 +endif + +#------------------------------------------------------------------------------ +# Setting assembler data. +#------------------------------------------------------------------------------ +%.$(OBJ): %.s + cpp $(ASM_FLAGS) <$< | grep -v '^#' >$*.tmp + $(ASM) -o $@ $*.tmp + rm $*.tmp + +ASSEMBLY_SOURCE=$(arch)-gas +ifeq (itanium,$(arch)) + ASM=as + TBB_ASM.OBJ = atomic_support.o lock_byte.o log2.o pause.o +endif +#------------------------------------------------------------------------------ +# End of setting assembler data. +#------------------------------------------------------------------------------ + +#------------------------------------------------------------------------------ +# Setting tbbmalloc data. +#------------------------------------------------------------------------------ + +#M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-exceptions -fno-schedule-insns2 +M_CPLUS_FLAGS = $(CPLUS_FLAGS) -fno-rtti -fno-schedule-insns2 + +#------------------------------------------------------------------------------ +# End of setting tbbmalloc data. +#------------------------------------------------------------------------------ Index: build/common.inc =================================================================== --- build/common.inc (revision 227170) +++ build/common.inc (working copy) @@ -25,22 +25,25 @@ # the GNU General Public License. ifndef tbb_os + ifeq ($(OS),) + OS:=$(shell uname) + ifeq ($(OS),) + $(error "$(OS) is not supported") + endif + export tbb_os=$(OS) + endif ifeq ($(OS), Windows_NT) export tbb_os=windows - else - OS:=$(shell uname) - ifeq ($(OS),) - $(error "$(OS) is not supported") - else - export tbb_os=$(OS) - ifeq ($(OS), Linux) - export tbb_os=linux - endif - ifeq ($(OS), Darwin) - export tbb_os=macos - endif - endif # OS successfully detected - endif # !Windows + endif + ifeq ($(OS), Linux) + export tbb_os=linux + endif + ifeq ($(OS), Darwin) + export tbb_os=macos + endif + ifeq ($(OS), QNX) + export tbb_os=qnx + endif endif # !tbb_os ifeq ($(wildcard $(tbb_root)/build/$(tbb_os).inc),) Index: build/version_info_qnx.sh =================================================================== --- build/version_info_qnx.sh (revision 0) +++ build/version_info_qnx.sh (revision 0) @@ -0,0 +1,42 @@ +#!/bin/sh +# +# Copyright 2005-2008 Intel Corporation. All Rights Reserved. +# +# This file is part of Threading Building Blocks. +# +# Threading Building Blocks is free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public License +# version 2 as published by the Free Software Foundation. +# +# Threading Building Blocks is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied warranty +# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Threading Building Blocks; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# As a special exception, you may use this file as part of a free software +# library without restriction. Specifically, if other files instantiate +# templates or use macros or inline functions from this file, or you compile +# this file and link it with other files to produce an executable, this +# file does not by itself cause the resulting executable to be covered by +# the GNU General Public License. This exception does not however +# invalidate any other reasons why the executable file might be covered by +# the GNU General Public License. + +# Script used to generate version info string +echo "#define __TBB_VERSION_STRINGS \\" +echo '"TBB:' "BUILD_HOST\t\t"`hostname -s`'" ENDL \' +echo '"TBB:' "BUILD_OS\t\t"`head -1 /etc/issue | sed -e 's/\\\\//g'`'" ENDL \' +echo '"TBB:' "BUILD_KERNEL\t"`uname -rv`'" ENDL \' +echo '"TBB:' "BUILD_GCC\t\t"`ntox86-g++ -v &1 | grep 'gcc.*version'`'" ENDL \' +[ -z "$COMPILER_VERSION" ] || echo '"TBB:' "BUILD_COMPILER\t"$COMPILER_VERSION'" ENDL \' +#echo '"TBB:' "BUILD_GLIBC\t"`getconf GNU_LIBC_VERSION | grep glibc | sed -e 's/^glibc //'`'" ENDL \' +echo '"TBB:' "BUILD_LIBC\t"`use -i ${QNX_TARGET}/x86/lib/libc.so | awk 'BEGIN { FS = "=" } /VERSION/ { print $$2 }'`'" ENDL \' +echo '"TBB:' "BUILD_LD\t\t"`ntox86-ld -v | grep 'version'`'" ENDL \' +echo '"TBB:' "BUILD_TARGET\t$arch on $runtime"'" ENDL \' +echo '"TBB:' "BUILD_COMMAND\t"$*'" ENDL \' +echo "" +echo "#define __TBB_DATETIME \""`date -u`"\"" Index: build/qnx.inc =================================================================== --- build/qnx.inc (revision 0) +++ build/qnx.inc (revision 0) @@ -0,0 +1,98 @@ +# Copyright 2005-2008 Intel Corporation. All Rights Reserved. +# +# This file is part of Threading Building Blocks. +# +# Threading Building Blocks is free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public License +# version 2 as published by the Free Software Foundation. +# +# Threading Building Blocks is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied warranty +# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Threading Building Blocks; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# As a special exception, you may use this file as part of a free software +# library without restriction. Specifically, if other files instantiate +# templates or use macros or inline functions from this file, or you compile +# this file and link it with other files to produce an executable, this +# file does not by itself cause the resulting executable to be covered by +# the GNU General Public License. This exception does not however +# invalidate any other reasons why the executable file might be covered by +# the GNU General Public License. + +ifndef arch + export arch:=ia32 +# ifeq ($(shell uname -m),i686) +# export arch:=ia32 +# endif +# ifeq ($(shell uname -m),ia64) +# export arch:=itanium +# endif +# ifeq ($(shell uname -m),x86_64) +# export arch:=em64t +# endif +endif + +ifndef runtime + #gcc_version:=$(shell gcc -v 2>&1 | grep 'gcc --version' | sed -e 's/^gcc version //' | sed -e 's/ .*$$//') + gcc_version_full=$(shell gcc --version | grep 'gcc'| egrep -o ' [0-9]+\.[0-9]+\.[0-9]+.*' | sed -e 's/^\ //') + gcc_version=$(shell echo "$(gcc_version_full)" | egrep -o '^[0-9]+\.[0-9]+\.[0-9]+\s*' | head -n 1 | sed -e 's/ *//g') +# os_version:=$(shell uname -r) + os_version:=$(shell qconfig -i | awk '/version:/ { print $$2 }') + os_kernel_version:=$(shell strings ${QNX_TARGET}/x86/boot/sys/procnto-instr | grep "6\.[0-9]\.[0-9]") + #export os_glibc_version_full:=$(shell getconf GNU_LIBC_VERSION | grep glibc | sed -e 's/^glibc //') + #os_glibc_version:=$(shell echo "$(os_glibc_version_full)" | sed -e '2,$$d' -e 's/-.*$$//') + os_libc_version:=$(shell use -i ${QNX_TARGET}/x86/lib/libc.so | awk 'BEGIN { FS = "=" } /VERSION/ { print $$2 }') + export runtime:=cc$(gcc_version)_libc$(os_glibc_version)_kernel$(os_kernel_version) +endif + +#native_compiler := gcc +#export compiler ?= gcc +#debugger ?= gdb +native_compiler := qcc +export compiler ?= qcc +debugger ?= ntox86-gdb + +CMD=sh -c +CWD=$(shell pwd) +RM?=rm -f +RD?=rmdir +MD?=mkdir -p +NUL= /dev/null +SLASH=/ +MAKE_VERSIONS=sh $(tbb_root)/build/version_info_qnx.sh $(CPLUS) $(CPLUS_FLAGS) $(INCLUDES) >version_string.tmp +MAKE_TBBVARS=sh $(tbb_root)/build/generate_tbbvars.sh + +ifdef LD_LIBRARY_PATH + export LD_LIBRARY_PATH := .:$(LD_LIBRARY_PATH) +else + export LD_LIBRARY_PATH := . +endif + +####### Build settigns ######################################################## + +OBJ = o +DLL = so +LIBEXT = so +SONAME_SUFFIX =$(shell grep TBB_COMPATIBLE_INTERFACE_VERSION $(tbb_root)/include/tbb/tbb_stddef.h | egrep -o [0-9.]+) + +def_prefix = $(if $(findstring 32,$(arch)),qnx32,$(if $(findstring 64,$(arch)),qnx64,qnx64ipf)) +#TBB.DEF = $(tbb_root)/src/tbb/$(def_prefix)-tbb-export.def +#EXPORT_KEY = -Wl,--version-script, +TBB.DLL = $(TBB_NO_VERSION.DLL).$(SONAME_SUFFIX) +TBB.LIB = $(TBB.DLL) +TBB_NO_VERSION.DLL=libtbb$(DEBUG_SUFFIX).$(DLL) +LINK_TBB.LIB = $(TBB_NO_VERSION.DLL) + +MALLOC_NO_VERSION.DLL = libtbbmalloc$(DEBUG_SUFFIX).$(DLL) +#MALLOC.DEF = $(MALLOC_ROOT)/lin-tbbmalloc-export.def +MALLOC.DLL = $(MALLOC_NO_VERSION.DLL).$(SONAME_SUFFIX) +MALLOC.LIB = $(MALLOC_NO_VERSION.DLL) + +TBB_NOSTRICT=1 + +TEST_LAUNCHER=sh $(tbb_root)/build/test_launcher.sh Index: include/tbb/tbb_machine.h =================================================================== --- include/tbb/tbb_machine.h (revision 227170) +++ include/tbb/tbb_machine.h (working copy) @@ -83,6 +83,9 @@ #include "tbb/machine/linux_em64t.h" #endif +#elif __QNX__ +#define __volatile__ volatile +#include "tbb/machine/qnx_i386.h" #endif #if !defined(__TBB_CompareAndSwap4) || !defined(__TBB_CompareAndSwap8) || !defined(__TBB_Yield) Index: include/tbb/tbb_stddef.h =================================================================== --- include/tbb/tbb_stddef.h (revision 227170) +++ include/tbb/tbb_stddef.h (working copy) @@ -139,7 +139,11 @@ } // namespace tbb #else #include +#ifdef __QNX__ +#include +#include #endif +#endif #include /* Need size_t and ptrdiff_t (the latter on Windows only) from here. */ Index: include/tbb/machine/qnx_common.h =================================================================== --- include/tbb/machine/qnx_common.h (revision 0) +++ include/tbb/machine/qnx_common.h (revision 0) @@ -0,0 +1,46 @@ +/* + Copyright 2005-2008 Intel Corporation. All Rights Reserved. + + This file is part of Threading Building Blocks. + + Threading Building Blocks is free software; you can redistribute it + and/or modify it under the terms of the GNU General Public License + version 2 as published by the Free Software Foundation. + + Threading Building Blocks is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied warranty + of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Threading Building Blocks; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + As a special exception, you may use this file as part of a free software + library without restriction. Specifically, if other files instantiate + templates or use macros or inline functions from this file, or you compile + this file and link it with other files to produce an executable, this + file does not by itself cause the resulting executable to be covered by + the GNU General Public License. This exception does not however + invalidate any other reasons why the executable file might be covered by + the GNU General Public License. +*/ + +#ifndef __TBB_machine_H +#error Do not include this file directly; include tbb_machine.h instead +#endif + +#include +#include +#include +#include +#include +#include +#include + +static inline int __qnx_get_num_cpu(void) { + return _syspage_ptr->num_cpu; +} +// Definition of __TBB_Yield() +#define __TBB_Yield() sched_yield() +#define __TBB_DetectNumberOfWorkers() __qnx_get_num_cpu() Index: include/tbb/machine/qnx_i386.h =================================================================== --- include/tbb/machine/qnx_i386.h (revision 0) +++ include/tbb/machine/qnx_i386.h (revision 0) @@ -0,0 +1,245 @@ +/* + Copyright 2005-2008 Intel Corporation. All Rights Reserved. + + This file is part of Threading Building Blocks. + + Threading Building Blocks is free software; you can redistribute it + and/or modify it under the terms of the GNU General Public License + version 2 as published by the Free Software Foundation. + + Threading Building Blocks is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied warranty + of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Threading Building Blocks; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + As a special exception, you may use this file as part of a free software + library without restriction. Specifically, if other files instantiate + templates or use macros or inline functions from this file, or you compile + this file and link it with other files to produce an executable, this + file does not by itself cause the resulting executable to be covered by + the GNU General Public License. This exception does not however + invalidate any other reasons why the executable file might be covered by + the GNU General Public License. +*/ + +#ifndef __TBB_machine_H +#error Do not include this file directly; include tbb_machine.h instead +#endif + +#include "qnx_common.h" + +#define __TBB_WORDSIZE 4 +#define __TBB_BIG_ENDIAN 0 + + +#define __MACHINE_DECL_ATOMICS(S,T,X) \ +static inline T __TBB_machine_cmpswp##S (volatile void *ptr, T value, T comparand ) \ +{ \ + T result; \ + \ + __asm__ __volatile__("lock\ncmpxchg" X " %2,%1" \ + : "=a"(result), "=m"(*(T *)ptr) \ + : "q"(value), "0"(comparand) \ + : "memory"); \ + return result; \ +} \ + \ +static inline T __TBB_machine_fetchadd##S(volatile void *ptr, T addend) \ +{ \ + T result; \ + __asm__ __volatile__("lock\nxadd" X " %0,%1" \ + : "=r"(result), "=m"(*(T *)ptr) \ + : "0"(addend) \ + : "memory"); \ + return result; \ +} \ + \ +static inline T __TBB_machine_fetchstore##S(volatile void *ptr, T value) \ +{ \ + T result; \ + __asm__ __volatile__("lock\nxchg" X " %0,%1" \ + : "=r"(result), "=m"(*(T *)ptr) \ + : "0"(value) \ + : "memory"); \ + return result; \ +} \ + +__MACHINE_DECL_ATOMICS(1,int8_t,"") +__MACHINE_DECL_ATOMICS(2,int16_t,"") +__MACHINE_DECL_ATOMICS(4,int32_t,"l") + +static int64_t __TBB_machine_cmpswp8 (volatile void *ptr, int64_t value, int64_t comparand ) +{ + int64_t result; + union { + int64_t comparand_local; + int32_t comparand_parts[2]; + }; + comparand_local = comparand; + // EBX register saved for compliancy with position-independent code (PIC) rules on IA32 + __asm__ __volatile__ ( + "pushl %%ebx\n\t" + "movl (%%ecx),%%ebx\n\t" + "movl 4(%%ecx),%%ecx\n\t" + "lock\ncmpxchg8b (%2)\n\t" + "popl %%ebx" + : "=A"(result), "=m"(*(int64_t *)ptr) + : "S"(ptr), + "a"(comparand_parts[0]), + "d"(comparand_parts[1]), + "c"(&value) + : "memory", "esp"); + return result; +} + +static inline int32_t __TBB_machine_lg( uint32_t x ) { + int32_t j; + __asm__ ("bsr %1,%0" : "=r"(j) : "r"(x)); + return j; +} + +static inline void __TBB_machine_or( volatile void *ptr, uint32_t addend ) { + __asm__ __volatile__("lock\norl %1,%0" : "=m"(*(uint32_t *)ptr) : "r"(addend) : "memory"); +} + +static inline void __TBB_machine_and( volatile void *ptr, uint32_t addend ) { + __asm__ __volatile__("lock\nandl %1,%0" : "=m"(*(uint32_t *)ptr) : "r"(addend) : "memory"); +} + +static inline void __TBB_machine_pause( int32_t delay ) { + for (int32_t i = 0; i < delay; i++) { + __asm__ __volatile__("pause;"); + } + return; +} + +static inline int64_t __TBB_machine_load8 (const volatile void *ptr) { + int64_t result; + if( ((uint32_t)ptr&7u)==0 ) { + // Aligned load + __asm__ __volatile__ ( "fildq %1\n\t" + "fistpq %0" : "=m"(result) : "m"(*(uint64_t *)ptr), "m"(result) : "memory" ); + } else { + // Unaligned load + result = __TBB_machine_cmpswp8((void*)ptr,0,0); + } + return result; +} + +//! Handles misaligned 8-byte store +/** Defined in tbb_misc.cpp */ +extern "C" void __TBB_machine_store8_slow( volatile void *ptr, int64_t value ); + +static inline void __TBB_machine_store8(volatile void *ptr, int64_t value) { + if( ((uint32_t)ptr&7u)==0 ) { + // Aligned store + __asm__ __volatile__ ( "fildq %1\n\t" + "fistpq (%2)" : "=m"(*(int64_t *)ptr) : "m"(value), "r"(ptr) : "memory" ); + } else { + // Unaligned store + __TBB_machine_store8_slow(ptr,value); + } +} + +template +struct __TBB_machine_load_store { + static inline T load_with_acquire(const volatile T& location) { + T to_return = location; + __asm__ __volatile__("" : : : "memory" ); // Compiler fence to keep operations from migrating upwards + return to_return; + } + + static inline void store_with_release(volatile T &location, T value) { + __asm__ __volatile__("" : : : "memory" ); // Compiler fence to keep operations from migrating upwards + location = value; + } +}; + +template +struct __TBB_machine_load_store { + static inline T load_with_acquire(const volatile T& location) { + T to_return = __TBB_machine_load8((volatile void *)&location); + __asm__ __volatile__("" : : : "memory" ); // Compiler fence to keep operations from migrating upwards + return to_return; + } + + static inline void store_with_release(volatile T &location, T value) { + __asm__ __volatile__("" : : : "memory" ); // Compiler fence to keep operations from migrating downwards + __TBB_machine_store8((volatile void *)&location,(int64_t)value); + } +}; + +template +inline T __TBB_machine_load_with_acquire(const volatile T &location) { + return __TBB_machine_load_store::load_with_acquire(location); +} + +template +inline void __TBB_machine_store_with_release(volatile T &location, V value) { + __TBB_machine_load_store::store_with_release(location,value); +} + +#define __TBB_load_with_acquire(L) __TBB_machine_load_with_acquire((L)) +#define __TBB_store_with_release(L,V) __TBB_machine_store_with_release((L),(V)) + +// Machine specific atomic operations + +#define __TBB_CompareAndSwap1(P,V,C) __TBB_machine_cmpswp1(P,V,C) +#define __TBB_CompareAndSwap2(P,V,C) __TBB_machine_cmpswp2(P,V,C) +#define __TBB_CompareAndSwap4(P,V,C) __TBB_machine_cmpswp4(P,V,C) +#define __TBB_CompareAndSwap8(P,V,C) __TBB_machine_cmpswp8(P,V,C) +#define __TBB_CompareAndSwapW(P,V,C) __TBB_machine_cmpswp4(P,V,C) + +#define __TBB_FetchAndAdd1(P,V) __TBB_machine_fetchadd1(P,V) +#define __TBB_FetchAndAdd2(P,V) __TBB_machine_fetchadd2(P,V) +#define __TBB_FetchAndAdd4(P,V) __TBB_machine_fetchadd4(P,V) +#define __TBB_FetchAndAddW(P,V) __TBB_machine_fetchadd4(P,V) + +#define __TBB_FetchAndStore1(P,V) __TBB_machine_fetchstore1(P,V) +#define __TBB_FetchAndStore2(P,V) __TBB_machine_fetchstore2(P,V) +#define __TBB_FetchAndStore4(P,V) __TBB_machine_fetchstore4(P,V) +#define __TBB_FetchAndStoreW(P,V) __TBB_machine_fetchstore4(P,V) + +#define __TBB_Store8(P,V) __TBB_machine_store8(P,V) +#define __TBB_Load8(P) __TBB_machine_load8(P) + +#define __TBB_AtomicOR(P,V) __TBB_machine_or(P,V) +#define __TBB_AtomicAND(P,V) __TBB_machine_and(P,V) + + +// Those we chose not to implement (they will be implemented generically using CMPSWP8) +#undef __TBB_FetchAndAdd8 +#undef __TBB_FetchAndStore8 + +// Definition of other functions +#define __TBB_Pause(V) __TBB_machine_pause(V) +#define __TBB_Log2(V) __TBB_machine_lg(V) + +// Special atomic functions +#define __TBB_FetchAndAddWrelease(P,V) __TBB_FetchAndAddW(P,V) +#define __TBB_FetchAndIncrementWacquire(P) __TBB_FetchAndAddW(P,1) +#define __TBB_FetchAndDecrementWrelease(P) __TBB_FetchAndAddW(P,-1) + +// Definition of Lock functions +#undef __TBB_TryLockByte +#undef __TBB_LockByte + +#define __TBB_cpuid +static inline void __TBB_x86_cpuid( int32_t buffer[4], int32_t mode ) { + // EBX register saved for compliancy with position-independent code (PIC) rules on IA32 + __asm__ ("pushl %%ebx\n\t" + "cpuid\n\t" + "movl %%ebx,%1\n\t" + "popl %%ebx" + : "=a"(buffer[0]), + "=S"(buffer[1]), + "=c"(buffer[2]), + "=d"(buffer[3]) + : "0"(mode) + : "memory" ); +} + Index: src/tbbmalloc/MemoryAllocator.cpp =================================================================== --- src/tbbmalloc/MemoryAllocator.cpp (revision 227170) +++ src/tbbmalloc/MemoryAllocator.cpp (working copy) @@ -321,7 +321,7 @@ unsigned int pos; #if __ARCH_x86_32||__ARCH_x86_64 -# if __linux__||__APPLE__||__FreeBSD__ || __sun +# if __linux__||__APPLE__||__FreeBSD__ || __sun || __QNX__ __asm__ ("bsr %1,%0" : "=r"(pos) : "r"(number)); # elif (_WIN32 && (!_WIN64 || __INTEL_COMPILER)) __asm Index: src/tbb/itt_notify.cpp =================================================================== --- src/tbb/itt_notify.cpp (revision 227170) +++ src/tbb/itt_notify.cpp (working copy) @@ -80,7 +80,7 @@ // LIBITTNOTIFY_NAME is the name of the ITT notification library # if _WIN32||_WIN64 # define LIBITTNOTIFY_NAME "libittnotify.dll" -# elif __linux__ || __FreeBSD__ || __sun +# elif __linux__ || __FreeBSD__ || __sun || __QNX__ # define LIBITTNOTIFY_NAME "libittnotify.so" # elif __APPLE__ # define LIBITTNOTIFY_NAME "libittnotify.dylib" Index: src/tbb/cache_aligned_allocator.cpp =================================================================== --- src/tbb/cache_aligned_allocator.cpp (revision 227170) +++ src/tbb/cache_aligned_allocator.cpp (working copy) @@ -113,7 +113,7 @@ #define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".dylib" #elif __linux__ #define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX __TBB_STRING(.so.TBB_COMPATIBLE_INTERFACE_VERSION) -#elif __FreeBSD__ || __sun +#elif __FreeBSD__ || __sun || __QNX__ #define MALLOCLIB_NAME "libtbbmalloc" DEBUG_SUFFIX ".so" #else #error Unknown OS