diff -Nur asd/mozilla-1.9.2/ipc/chromium/src//base/atomicops.h mozilla-1.9.2/ipc/chromium/src//base/atomicops.h --- asd/mozilla-1.9.2/ipc/chromium/src//base/atomicops.h 2010-12-03 16:48:04.000000000 +0100 +++ mozilla-1.9.2/ipc/chromium/src//base/atomicops.h 2011-01-17 19:01:13.000000000 +0100 @@ -132,6 +132,8 @@ #include "base/atomicops_internals_x86_gcc.h" #elif defined(COMPILER_GCC) && defined(ARCH_CPU_ARM_FAMILY) #include "base/atomicops_internals_arm_gcc.h" +#elif defined(COMPILER_GCC) && defined(ARCH_CPU_PPC_FAMILY) +#include "base/atomicops_internals_ppc_gcc.h" #else #error "Atomic operations are not supported on your platform" #endif diff -Nur asd/mozilla-1.9.2/ipc/chromium/src//base/atomicops_internals_ppc_gcc.h mozilla-1.9.2/ipc/chromium/src//base/atomicops_internals_ppc_gcc.h --- asd/mozilla-1.9.2/ipc/chromium/src//base/atomicops_internals_ppc_gcc.h 1970-01-01 01:00:00.000000000 +0100 +++ mozilla-1.9.2/ipc/chromium/src//base/atomicops_internals_ppc_gcc.h 2011-01-17 19:42:29.000000000 +0100 @@ -0,0 +1,166 @@ +// Copyright (c) 2010 JJDaNiMoTh . All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file is an internal atomic implementation, use base/atomicops.h instead. + +#ifndef BASE_ATOMICOPS_INTERNALS_PPC_GCC_H_ +#define BASE_ATOMICOPS_INTERNALS_PPC_GCC_H_ +#define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory") + +#define __stringify_in_c(...) #__VA_ARGS__ +#define stringify_in_c(...) __stringify_in_c(__VA_ARGS__) " " + +#define FTR_ENTRY_OFFSET .long +#define START_LWSYNC_SECTION(label) label##1: +#define MAKE_LWSYNC_SECTION_ENTRY(label, sect) \ +label##2: \ + .pushsection sect,"a"; \ + .align 2; \ +label##3: \ + FTR_ENTRY_OFFSET label##1b-label##3b; \ + .popsection; + + +#define __PPC_ACQUIRE_BARRIER \ + START_LWSYNC_SECTION(97); \ + isync; \ +MAKE_LWSYNC_SECTION_ENTRY(97, __lwsync_fixup); +#define PPC_ACQUIRE_BARRIER "\n" stringify_in_c(__PPC_ACQUIRE_BARRIER) +#define PPC_RELEASE_BARRIER stringify_in_c(LWSYNC) "\n" + +namespace base { +namespace subtle { + +// 32-bit low-level operations on any platform. + +/* + * Compare and exchange - if *ptr == old, set it to new, + * and return the old value of *p. + */ +inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, + Atomic32 old_value, + Atomic32 new_value) { + Atomic32 prev; + + __asm__ __volatile__ ( + "1: lwarx %0,0,%2\n" + "cmpw 0,%0,%3\n" + "bne- 2f\n" + "stwcx. %4,0,%2\n" + "bne- 1b\n" + "2:\n" + : "=&r" (prev), "+m" (*ptr) + : "r" (ptr), "r" (old_value), "r" (new_value) + : "cc", "memory"); + + return prev; +} + +/* +* Atomic exchange +* +* Changes the memory location '*ptr' to be new_value and returns +* the previous value stored there. +*/ +inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, + Atomic32 new_value) { + Atomic32 prev; + + __asm__ __volatile__( +"1: lwarx %0,0,%2 \n" +" stwcx. %3,0,%2 \n\ + bne- 1b" + : "=&r" (prev), "+m" (*ptr) + : "r" (ptr), "r" (new_value) + : "cc", "memory"); + + return prev; +} + +inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, + Atomic32 increment) { + Atomic32 temp; + + __asm__ __volatile__( +"1: lwarx %0,0,%2\n\ + add %0,%1,%0\n" +" stwcx. %0,0,%2 \n\ + bne- 1b" + : "=&r" (temp) + : "r" (increment), "r" (ptr) + : "cc", "memory"); + + return temp; +} + +inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, + Atomic32 increment) { + Atomic32 temp; + + __asm__ __volatile__( + PPC_RELEASE_BARRIER +"1: lwarx %0,0,%2\n\ + add %0,%1,%0\n" +" stwcx. %0,0,%2 \n\ + bne- 1b" + PPC_ACQUIRE_BARRIER + : "=&r" (temp) + : "r" (increment), "r" (ptr) + : "cc", "memory"); + + return temp; +} + +inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, + Atomic32 old_value, + Atomic32 new_value) { + return NoBarrier_CompareAndSwap(ptr, old_value, new_value); +} + +inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, + Atomic32 old_value, + Atomic32 new_value) { + return NoBarrier_CompareAndSwap(ptr, old_value, new_value); +} + +inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) { + *ptr = value; +} + +inline void MemoryBarrier() { + __asm__ __volatile__("sync" : : : "memory"); +} + +inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) { + *ptr = value; + MemoryBarrier(); +} + +inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) { + MemoryBarrier(); + *ptr = value; +} + +inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { + return *ptr; +} + +inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) { + Atomic32 value = *ptr; + MemoryBarrier(); + return value; + +} + +inline Atomic32 Release_Load(volatile const Atomic32* ptr) { + MemoryBarrier(); + return *ptr; +} + +} // namespace base::subtle +} // namespace base + +#undef ATOMICOPS_COMPILER_BARRIER + +#endif // BASE_ATOMICOPS_INTERNALS_PPC_GCC_H_ diff -Nur asd/mozilla-1.9.2/ipc/chromium/src//base/data_pack.cc mozilla-1.9.2/ipc/chromium/src//base/data_pack.cc --- asd/mozilla-1.9.2/ipc/chromium/src//base/data_pack.cc 2010-12-03 16:48:05.000000000 +0100 +++ mozilla-1.9.2/ipc/chromium/src//base/data_pack.cc 2011-01-17 20:27:01.000000000 +0100 @@ -91,15 +91,7 @@ bool DataPack::Get(uint32_t resource_id, StringPiece* data) { // It won't be hard to make this endian-agnostic, but it's not worth // bothering to do right now. -#if defined(__BYTE_ORDER) - // Linux check - COMPILE_ASSERT(__BYTE_ORDER == __LITTLE_ENDIAN, - datapack_assumes_little_endian); -#elif defined(__BIG_ENDIAN__) - // Mac check - #error DataPack assumes little endian -#endif - +#warning DoTheRightThingMakingThisEndianAgnostic! DataPackEntry* target = reinterpret_cast( bsearch(&resource_id, mmap_->data() + kHeaderLength, resource_count_, sizeof(DataPackEntry), DataPackEntry::CompareById)); diff -Nur asd/mozilla-1.9.2/ipc/chromium/src//base/debug_util_posix.cc mozilla-1.9.2/ipc/chromium/src//base/debug_util_posix.cc --- asd/mozilla-1.9.2/ipc/chromium/src//base/debug_util_posix.cc 2010-12-03 16:48:05.000000000 +0100 +++ mozilla-1.9.2/ipc/chromium/src//base/debug_util_posix.cc 2011-01-17 20:01:22.000000000 +0100 @@ -108,8 +108,10 @@ // static void DebugUtil::BreakDebugger() { -#if !defined(ARCH_CPU_ARM_FAMILY) +#if !defined(ARCH_CPU_ARM_FAMILY) && !defined(ARCH_CPU_PPC_FAMILY) asm ("int3"); +#elif defined(ARCH_CPU_PPC_FAMILY) + // use the twi instruction.. #endif } diff -Nur asd/mozilla-1.9.2/ipc/chromium/src//build/build_config.h mozilla-1.9.2/ipc/chromium/src//build/build_config.h --- asd/mozilla-1.9.2/ipc/chromium/src//build/build_config.h 2010-12-03 16:48:05.000000000 +0100 +++ mozilla-1.9.2/ipc/chromium/src//build/build_config.h 2011-01-17 19:01:13.000000000 +0100 @@ -57,6 +57,8 @@ #define ARCH_CPU_ARMEL 1 #define ARCH_CPU_32_BITS 1 #define WCHAR_T_IS_UNSIGNED 1 +#elif defined(__powerpc__) || defined(__POWERPC__) +#define ARCH_CPU_PPC_FAMILY 1 #else #error Please add support for your architecture in build/build_config.h #endif