Fix SESSION5_INITIALIZATION_ERROR by reverting part of 22219. The code is the same as in pre-22219 era, but separated in different files

Thanks Alex for reporting the faulty revision

svn path=/trunk/; revision=22347
This commit is contained in:
Hervé Poussineau 2006-06-14 09:36:15 +00:00
parent 30c84451ef
commit 2aa4dc8052
6 changed files with 192 additions and 158 deletions

View file

@ -1,33 +1,37 @@
/*
* PROJECT: ReactOS system libraries
* LICENSE: GPL - See COPYING in the top level directory
* FILE: lib/intrlck/i386/compareexchange.s
* PURPOSE: Inter lock compare exchanges
* PROGRAMMERS: Copyright 1995 Martin von Loewis
* Copyright 1997 Onno Hovers
*/
/************************************************************************
* InterlockedCompareExchange
*
* Atomically compares Destination and Comperand, and if found equal exchanges
* the value of Destination with Exchange
*
* RETURNS
* Prior value of value pointed to by Destination
*/
/*
* LONG NTAPI InterlockedCompareExchange(LPLONG Destination, LONG Exchange, LONG Comperand)
*/
.globl _InterlockedCompareExchange@12
_InterlockedCompareExchange@12:
movl 12(%esp),%eax
movl 8(%esp),%ecx
movl 4(%esp),%edx
lock
cmpxchgl %ecx,(%edx)
leave
ret $12
/*
* PROJECT: ReactOS system libraries
* LICENSE: GPL - See COPYING in the top level directory
* FILE: lib/intrlck/i386/compareexchange.c
* PURPOSE: Inter lock compare exchanges
* PROGRAMMERS: Copyright 1995 Martin von Loewis
* Copyright 1997 Onno Hovers
*/
/************************************************************************
* InterlockedCompareExchange
*
* Atomically compares Destination and Comperand, and if found equal exchanges
* the value of Destination with Exchange
*
* RETURNS
* Prior value of value pointed to by Destination
*/
/*
* LONG NTAPI InterlockedCompareExchange(LPLONG Destination, LONG Exchange, LONG Comperand)
*/
#include <windows.h>
LONG
NTAPI
InterlockedCompareExchange(
LPLONG Destination,
LONG Exchange,
LONG Comperand)
{
LONG ret;
__asm__ __volatile__(
"lock; cmpxchgl %2,(%1)"
: "=a" (ret) : "r" (Destination), "r" (Exchange), "0" (Comperand) : "memory" );
return ret;
}

View file

@ -1,31 +1,38 @@
/*
* PROJECT: ReactOS system libraries
* LICENSE: GPL - See COPYING in the top level directory
* FILE: lib/intrlck/i386/decrement.s
* PURPOSE: Inter lock decrements
* PROGRAMMERS: Copyright 1995 Martin von Loewis
* Copyright 1997 Onno Hovers
*/
/************************************************************************
* InterlockedDecrement *
* *
* InterlockedDecrement adds -1 to a long variable and returns *
* the resulting decremented value. *
* *
************************************************************************/
/*
* LONG NTAPI InterlockedDecrement(LPLONG lpAddend)
*/
.globl _InterlockedDecrement@4
_InterlockedDecrement@4:
movl $-1,%ebx
lock
xaddl %eax,%ebx
decl %eax
leave
ret $4
/*
* PROJECT: ReactOS system libraries
* LICENSE: GPL - See COPYING in the top level directory
* FILE: lib/intrlck/i386/decrement.c
* PURPOSE: Inter lock decrements
* PROGRAMMERS: Copyright 1995 Martin von Loewis
* Copyright 1997 Onno Hovers
*/
/************************************************************************
* InterlockedDecrement *
* *
* InterlockedDecrement adds -1 to a long variable and returns *
* the resulting decremented value. *
* *
************************************************************************/
/*
* LONG NTAPI InterlockedDecrement(LPLONG lpAddend)
*/
#include <windows.h>
LONG
NTAPI
InterlockedDecrement(LPLONG lpAddend)
{
LONG ret;
__asm__
(
"\tlock\n" /* for SMP systems */
"\txaddl %0, (%1)\n"
"\tdecl %0\n"
:"=r" (ret)
:"r" (lpAddend), "0" (-1)
: "memory"
);
return ret;
}

View file

@ -1,29 +1,34 @@
/*
* PROJECT: ReactOS system libraries
* LICENSE: GPL - See COPYING in the top level directory
* FILE: lib/intrlck/i386/exchange.s
* PURPOSE: Inter lock exchanges
* PROGRAMMERS: Copyright 1995 Martin von Loewis
* Copyright 1997 Onno Hovers
*/
/************************************************************************
* InterlockedExchange
*
* Atomically exchanges a pair of values.
*
* RETURNS
* Prior value of value pointed to by Target
*/
/*
* LONG NTAPI InterlockedExchange(LPLONG target, LONG value)
*/
.globl _InterlockedExchange@8
_InterlockedExchange@8:
lock
xchgl %eax,%ebx
leave
ret $8
/*
* PROJECT: ReactOS system libraries
* LICENSE: GPL - See COPYING in the top level directory
* FILE: lib/intrlck/i386/exchange.c
* PURPOSE: Inter lock exchanges
* PROGRAMMERS: Copyright 1995 Martin von Loewis
* Copyright 1997 Onno Hovers
*/
/************************************************************************
* InterlockedExchange
*
* Atomically exchanges a pair of values.
*
* RETURNS
* Prior value of value pointed to by Target
*/
/*
* LONG NTAPI InterlockedExchange(LPLONG target, LONG value)
*/
#include <windows.h>
LONG
NTAPI
InterlockedExchange(LPLONG target, LONG value)
{
LONG ret;
__asm__ (
/* lock for SMP systems */
"lock\n\txchgl %0,(%1)"
:"=r" (ret):"r" (target), "0" (value):"memory" );
return ret;
}

View file

@ -1,30 +1,40 @@
/*
* PROJECT: ReactOS system libraries
* LICENSE: GPL - See COPYING in the top level directory
* FILE: lib/intrlck/i386/exchangeadd.s
* PURPOSE: Inter lock exchange adds
* PROGRAMMERS: Copyright 1995 Martin von Loewis
* Copyright 1997 Onno Hovers
*/
/************************************************************************
* InterlockedExchangeAdd
*
* Atomically adds Increment to Addend and returns the previous value of
* Addend
*
* RETURNS
* Prior value of value pointed to by Addend
*/
/*
* LONG NTAPI InterlockedExchangeAdd(PLONG Addend, LONG Increment)
*/
.globl _InterlockedExchangeAdd@8
_InterlockedExchangeAdd@8:
lock
xaddl %eax,%ebx
leave
ret $4
/*
* PROJECT: ReactOS system libraries
* LICENSE: GPL - See COPYING in the top level directory
* FILE: lib/intrlck/i386/exchangeadd.c
* PURPOSE: Inter lock exchange adds
* PROGRAMMERS: Copyright 1995 Martin von Loewis
* Copyright 1997 Onno Hovers
*/
/************************************************************************
* InterlockedExchangeAdd
*
* Atomically adds Increment to Addend and returns the previous value of
* Addend
*
* RETURNS
* Prior value of value pointed to by Addend
*/
/*
* LONG NTAPI InterlockedExchangeAdd(PLONG Addend, LONG Increment)
*/
#include <windows.h>
LONG
NTAPI
InterlockedExchangeAdd(
PLONG Addend,
LONG Increment)
{
LONG ret;
__asm__ (
/* lock for SMP systems */
"lock\n\t"
"xaddl %0,(%1)"
:"=r" (ret)
:"r" (Addend), "0" (Increment)
:"memory" );
return ret;
}

View file

@ -1,30 +1,38 @@
/*
* PROJECT: ReactOS system libraries
* LICENSE: GPL - See COPYING in the top level directory
* FILE: lib/intrlck/i386/increment.s
* PURPOSE: Inter lock increments
* PROGRAMMERS: Copyright 1995 Martin von Loewis
* Copyright 1997 Onno Hovers
*/
/************************************************************************
* InterlockedIncrement *
* *
* InterlockedIncrement adds 1 to a long variable and returns *
* the resulting incremented value. *
* *
************************************************************************/
/*
* LONG NTAPI InterlockedIncrement(PLONG Addend)
*/
.globl _InterlockedIncrement@4
_InterlockedIncrement@4:
movl $1,%ebx
lock
xaddl %eax,%ebx
incl %eax
leave
ret $4
/*
* PROJECT: ReactOS system libraries
* LICENSE: GPL - See COPYING in the top level directory
* FILE: lib/intrlck/i386/increment.c
* PURPOSE: Inter lock increments
* PROGRAMMERS: Copyright 1995 Martin von Loewis
* Copyright 1997 Onno Hovers
*/
/************************************************************************
* InterlockedIncrement *
* *
* InterlockedIncrement adds 1 to a long variable and returns *
* the resulting incremented value. *
* *
************************************************************************/
/*
* LONG NTAPI InterlockedIncrement(PLONG Addend)
*/
#include <windows.h>
LONG
NTAPI
InterlockedIncrement(PLONG lpAddend)
{
LONG ret;
__asm__
(
"\tlock\n" /* for SMP systems */
"\txaddl %0, (%1)\n"
"\tincl %0\n"
:"=r" (ret)
:"r" (lpAddend), "0" (1)
: "memory"
);
return ret;
}

View file

@ -3,11 +3,11 @@
<if property="ARCH" value="i386">
<directory name="i386">
<file>compareexchange.s</file>
<file>decrement.s</file>
<file>exchange.s</file>
<file>exchangeadd.s</file>
<file>increment.s</file>
<file>compareexchange.c</file>
<file>decrement.c</file>
<file>exchange.c</file>
<file>exchangeadd.c</file>
<file>increment.c</file>
</directory>
</if>
<if property="ARCH" value="ppc">