mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 07:40:42 +00:00
Bugzilla bug #30902: use true atomic implementation of the NSPR atomic
routines on Linux on Intel x86. Modified files: _linux.h, pr/src/md/unix/Makefile, pr/src/md/unix/Makefile.in, pr/src/md/unix/objs.mk Added file: os_Linux_x86.s
This commit is contained in:
parent
6ed7f258ec
commit
93eb670cbb
@ -59,6 +59,19 @@
|
||||
#define HAVE_DLL
|
||||
#define USE_DLFCN
|
||||
|
||||
#if defined(__i386__)
|
||||
#define _PR_HAVE_ATOMIC_OPS
|
||||
#define _MD_INIT_ATOMIC()
|
||||
extern PRInt32 _PR_x86_AtomicIncrement(PRInt32 *val);
|
||||
#define _MD_ATOMIC_INCREMENT _PR_x86_AtomicIncrement
|
||||
extern PRInt32 _PR_x86_AtomicDecrement(PRInt32 *val);
|
||||
#define _MD_ATOMIC_DECREMENT _PR_x86_AtomicDecrement
|
||||
extern PRInt32 _PR_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val);
|
||||
#define _MD_ATOMIC_ADD _PR_x86_AtomicAdd
|
||||
extern PRInt32 _PR_x86_AtomicSet(PRInt32 *val, PRInt32 newval);
|
||||
#define _MD_ATOMIC_SET _PR_x86_AtomicSet
|
||||
#endif
|
||||
|
||||
#define USE_SETJMP
|
||||
#if defined(__GLIBC__) && __GLIBC__ >= 2
|
||||
#define _PR_POLL_AVAILABLE
|
||||
|
@ -237,6 +237,12 @@ ifeq ($(OS_ARCH),SunOS)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),Linux)
|
||||
ifeq ($(CPU_ARCH),x86)
|
||||
ASFILES = os_Linux_x86.s
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), SINIX)
|
||||
ifeq ($(CPU_ARCH),mips)
|
||||
ASFILES = os_ReliantUNIX.s
|
||||
|
@ -248,6 +248,12 @@ ifeq ($(OS_ARCH),SunOS)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),Linux)
|
||||
ifeq ($(CPU_ARCH),x86)
|
||||
ASFILES = os_Linux_x86.s
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), SINIX)
|
||||
ifeq ($(CPU_ARCH),mips)
|
||||
ASFILES = os_ReliantUNIX.s
|
||||
|
@ -235,6 +235,12 @@ ifeq ($(OS_ARCH),SunOS)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),Linux)
|
||||
ifeq ($(CPU_ARCH),x86)
|
||||
ASFILES = os_Linux_x86.s
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH), SINIX)
|
||||
ifeq ($(CPU_ARCH),mips)
|
||||
ASFILES = os_ReliantUNIX.s
|
||||
|
83
nsprpub/pr/src/md/unix/os_Linux_x86.s
Normal file
83
nsprpub/pr/src/md/unix/os_Linux_x86.s
Normal file
@ -0,0 +1,83 @@
|
||||
/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/
|
||||
/ The contents of this file are subject to the Netscape Public License
|
||||
/ Version 1.1 (the "NPL"); you may not use this file except in
|
||||
/ compliance with the NPL. You may obtain a copy of the NPL at
|
||||
/ http://www.mozilla.org/NPL/
|
||||
/
|
||||
/ Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
/ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
/ for the specific language governing rights and limitations under the
|
||||
/ NPL.
|
||||
/
|
||||
/ The Initial Developer of this code under the NPL is Netscape
|
||||
/ Communications Corporation. Portions created by Netscape are
|
||||
/ Copyright (C) 2000 Netscape Communications Corporation. All Rights
|
||||
/ Reserved.
|
||||
/
|
||||
|
||||
/ PRInt32 _PR_x86_AtomicIncrement(PRInt32 *val)
|
||||
/
|
||||
/ Atomically increment the integer pointed to by 'val' and return
|
||||
/ the result of the increment.
|
||||
/
|
||||
.text
|
||||
.globl _PR_x86_AtomicIncrement
|
||||
.align 4
|
||||
_PR_x86_AtomicIncrement:
|
||||
movl 4(%esp), %ecx
|
||||
movl $1, %eax
|
||||
nop
|
||||
lock
|
||||
xaddl %eax, (%ecx)
|
||||
incl %eax
|
||||
ret
|
||||
|
||||
/ PRInt32 _PR_x86_AtomicDecrement(PRInt32 *val)
|
||||
/
|
||||
/ Atomically decrement the integer pointed to by 'val' and return
|
||||
/ the result of the decrement.
|
||||
/
|
||||
.text
|
||||
.globl _PR_x86_AtomicDecrement
|
||||
.align 4
|
||||
_PR_x86_AtomicDecrement:
|
||||
movl 4(%esp), %ecx
|
||||
movl $-1, %eax
|
||||
nop
|
||||
lock
|
||||
xaddl %eax, (%ecx)
|
||||
decl %eax
|
||||
ret
|
||||
|
||||
/ PRInt32 _PR_x86_AtomicSet(PRInt32 *val, PRInt32 newval)
|
||||
/
|
||||
/ Atomically set the integer pointed to by 'val' to the new
|
||||
/ value 'newval' and return the old value.
|
||||
/
|
||||
.text
|
||||
.globl _PR_x86_AtomicSet
|
||||
.align 4
|
||||
_PR_x86_AtomicSet:
|
||||
movl 4(%esp), %ecx
|
||||
movl 8(%esp), %eax
|
||||
lock
|
||||
xchgl %eax, (%ecx)
|
||||
ret
|
||||
|
||||
/ PRInt32 _PR_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val)
|
||||
/
|
||||
/ Atomically add 'val' to the integer pointed to by 'ptr'
|
||||
/ and return the result of the addition.
|
||||
/
|
||||
.text
|
||||
.globl _PR_x86_AtomicAdd
|
||||
.align 4
|
||||
_PR_x86_AtomicAdd:
|
||||
movl 4(%esp), %ecx
|
||||
movl 8(%esp), %eax
|
||||
movl 8(%esp), %edx
|
||||
lock
|
||||
xaddl %eax, (%ecx)
|
||||
addl %edx, %eax
|
||||
ret
|
Loading…
x
Reference in New Issue
Block a user