[arm/Linux] Don't rely on KUSER_HELPERS feature

ARM specific CONFIG_KUSER_HELPERS kernel feature for Linux can be disabled,
and in this case, we shouldn't crash. Use a __sync_synchronize() call
instead for Linux platforms.

BUG=chromium:599051
LOG=Y

Review URL: https://codereview.chromium.org/1840203004

Cr-Commit-Position: refs/heads/master@{#35170}
This commit is contained in:
jbriance 2016-03-31 08:54:12 -07:00 committed by Commit bot
parent 9da14dbeda
commit 0b557da25f
2 changed files with 4 additions and 2 deletions

View File

@ -71,6 +71,7 @@ Jianghua Yang <jianghua.yjh@alibaba-inc.com>
Joel Stanley <joel@jms.id.au>
Johan Bergström <johan@bergstroem.nu>
Jonathan Liu <net147@gmail.com>
Julien Brianceau <jbriance@cisco.com>
JunHo Seo <sejunho@gmail.com>
Kang-Hao (Kenny) Lu <kennyluck@csail.mit.edu>
Karl Skomski <karl@skomski.com>

View File

@ -44,14 +44,15 @@ namespace base {
//
inline void MemoryBarrier() {
#if defined(__linux__) || defined(__ANDROID__)
#if defined(__ANDROID__)
// Note: This is a function call, which is also an implicit compiler barrier.
typedef void (*KernelMemoryBarrierFunc)();
((KernelMemoryBarrierFunc)0xffff0fa0)();
#elif defined(__QNXNTO__)
__cpu_membarrier();
#else
#error MemoryBarrier() is not implemented on this platform.
// Fallback to GCC built-in function
__sync_synchronize();
#endif
}