x86_64 changes :
added atomic*64() functions use int32 instead of long git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21430 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d08caee0a5
commit
a3ca7ebc40
|
@ -20,7 +20,7 @@ private:
|
||||||
static void CleanupRegionHorizontal(BRegion ®ion);
|
static void CleanupRegionHorizontal(BRegion ®ion);
|
||||||
|
|
||||||
static void SortRects(clipping_rect *rects, long count);
|
static void SortRects(clipping_rect *rects, long count);
|
||||||
static void SortTrans(long *lptr1, long *lptr2, long count);
|
static void SortTrans(int32 *lptr1, int32 *lptr2, long count);
|
||||||
|
|
||||||
static void CopyRegionMore(const BRegion &, BRegion &, long);
|
static void CopyRegionMore(const BRegion &, BRegion &, long);
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,13 @@ int32_t fssh_atomic_and(vint32_t *value, int32_t andValue);
|
||||||
int32_t fssh_atomic_or(vint32_t *value, int32_t orValue);
|
int32_t fssh_atomic_or(vint32_t *value, int32_t orValue);
|
||||||
int32_t fssh_atomic_get(vint32_t *value);
|
int32_t fssh_atomic_get(vint32_t *value);
|
||||||
|
|
||||||
|
int64_t fssh_atomic_set64(vint64_t *value, int64_t newValue);
|
||||||
|
int64_t fssh_atomic_test_and_set64(vint64_t *value, int64_t newValue,
|
||||||
|
int64_t testAgainst);
|
||||||
|
int64_t fssh_atomic_add64(vint64_t *value, int64_t addValue);
|
||||||
|
int64_t fssh_atomic_and64(vint64_t *value, int64_t andValue);
|
||||||
|
int64_t fssh_atomic_or64(vint64_t *value, int64_t orValue);
|
||||||
|
int64_t fssh_atomic_get64(vint64_t *value);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,13 @@
|
||||||
|
|
||||||
typedef uint32_t fssh_ulong;
|
typedef uint32_t fssh_ulong;
|
||||||
typedef volatile int32_t vint32_t;
|
typedef volatile int32_t vint32_t;
|
||||||
|
typedef volatile int64_t vint64_t;
|
||||||
|
|
||||||
|
#ifdef __x86_64__
|
||||||
|
typedef uint64_t fssh_addr_t;
|
||||||
|
#else
|
||||||
typedef uint32_t fssh_addr_t;
|
typedef uint32_t fssh_addr_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef int32_t fssh_dev_t;
|
typedef int32_t fssh_dev_t;
|
||||||
typedef int64_t fssh_ino_t;
|
typedef int64_t fssh_ino_t;
|
||||||
|
|
|
@ -351,7 +351,7 @@ BRegion::Support::SortRects(clipping_rect *rects, long count)
|
||||||
|
|
||||||
// Helper methods to swap transition points in two given arrays
|
// Helper methods to swap transition points in two given arrays
|
||||||
static inline void
|
static inline void
|
||||||
SwapTrans(long *leftPoints, long *rightPoints, long index1, long index2)
|
SwapTrans(int32 *leftPoints, int32 *rightPoints, long index1, long index2)
|
||||||
{
|
{
|
||||||
// First, swap the left points
|
// First, swap the left points
|
||||||
long tmp = leftPoints[index1];
|
long tmp = leftPoints[index1];
|
||||||
|
@ -366,7 +366,7 @@ SwapTrans(long *leftPoints, long *rightPoints, long index1, long index2)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BRegion::Support::SortTrans(long *lptr1, long *lptr2, long count)
|
BRegion::Support::SortTrans(int32 *lptr1, int32 *lptr2, long count)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
|
|
||||||
|
@ -779,9 +779,9 @@ BRegion::Support::SubRegionComplex(const BRegion &first, const BRegion &second,
|
||||||
// TODO: Find a better name for this function
|
// TODO: Find a better name for this function
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
InvertRectangles(long *lefts, long *rights, long count)
|
InvertRectangles(int32 *lefts, int32 *rights, long count)
|
||||||
{
|
{
|
||||||
long tmpLeft, tmpRight = kMaxNegative;
|
int32 tmpLeft, tmpRight = kMaxNegative;
|
||||||
|
|
||||||
for (int i = 0; i <= count; i++) {
|
for (int i = 0; i <= count; i++) {
|
||||||
tmpLeft = lefts[i] - 1;
|
tmpLeft = lefts[i] - 1;
|
||||||
|
|
|
@ -57,3 +57,52 @@ atomic_get(vint32 *value)
|
||||||
{
|
{
|
||||||
return *value;
|
return *value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int64
|
||||||
|
atomic_set64(vint64 *value, int64 newValue)
|
||||||
|
{
|
||||||
|
int64 oldValue = *value;
|
||||||
|
*value = newValue;
|
||||||
|
return oldValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int64
|
||||||
|
atomic_test_and_set64(vint64 *value, int64 newValue, int64 testAgainst)
|
||||||
|
{
|
||||||
|
int64 oldValue = *value;
|
||||||
|
if (oldValue == testAgainst)
|
||||||
|
*value = newValue;
|
||||||
|
return oldValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int64
|
||||||
|
atomic_add64(vint64 *value, int64 addValue)
|
||||||
|
{
|
||||||
|
int64 oldValue = *value;
|
||||||
|
*value += addValue;
|
||||||
|
return oldValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int64
|
||||||
|
atomic_and64(vint64 *value, int64 andValue)
|
||||||
|
{
|
||||||
|
int64 oldValue = *value;
|
||||||
|
*value &= andValue;
|
||||||
|
return oldValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int64
|
||||||
|
atomic_or64(vint64 *value, int64 orValue)
|
||||||
|
{
|
||||||
|
int64 oldValue = *value;
|
||||||
|
*value |= orValue;
|
||||||
|
return oldValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int64
|
||||||
|
atomic_get64(vint64 *value)
|
||||||
|
{
|
||||||
|
return *value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,3 +50,46 @@ fssh_atomic_get(vint32_t *value)
|
||||||
{
|
{
|
||||||
return atomic_get((vint32*)value);
|
return atomic_get((vint32*)value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int64_t
|
||||||
|
fssh_atomic_set64(vint64_t *value, int64_t newValue)
|
||||||
|
{
|
||||||
|
return atomic_set64((vint64*)value, newValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int64_t
|
||||||
|
fssh_atomic_test_and_set64(vint64_t *value, int64_t newValue, int64_t testAgainst)
|
||||||
|
{
|
||||||
|
return atomic_test_and_set64((vint64 *)value, newValue, testAgainst);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int64_t
|
||||||
|
fssh_atomic_add64(vint64_t *value, int64_t addValue)
|
||||||
|
{
|
||||||
|
return atomic_add64((vint64*)value, addValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int64_t
|
||||||
|
fssh_atomic_and64(vint64_t *value, int64_t andValue)
|
||||||
|
{
|
||||||
|
return atomic_and64((vint64*)value, andValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int64_t
|
||||||
|
fssh_atomic_or64(vint64_t *value, int64_t orValue)
|
||||||
|
{
|
||||||
|
return atomic_or64((vint64*)value, orValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int64_t
|
||||||
|
fssh_atomic_get64(vint64_t *value)
|
||||||
|
{
|
||||||
|
return atomic_get64((vint64*)value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -3222,8 +3222,13 @@ common_unlock_node(int fd, bool kernel)
|
||||||
|
|
||||||
// We need to set the locking atomically - someone
|
// We need to set the locking atomically - someone
|
||||||
// else might set one at the same time
|
// else might set one at the same time
|
||||||
|
#ifdef __x86_64__
|
||||||
|
if (fssh_atomic_test_and_set64((vint64_t *)&vnode->mandatory_locked_by,
|
||||||
|
0, (fssh_addr_t)descriptor) != (int64_t)descriptor)
|
||||||
|
#else
|
||||||
if (fssh_atomic_test_and_set((vint32_t *)&vnode->mandatory_locked_by,
|
if (fssh_atomic_test_and_set((vint32_t *)&vnode->mandatory_locked_by,
|
||||||
0, (fssh_addr_t)descriptor) != (int32_t)descriptor)
|
0, (fssh_addr_t)descriptor) != (int32_t)descriptor)
|
||||||
|
#endif
|
||||||
status = FSSH_B_BAD_VALUE;
|
status = FSSH_B_BAD_VALUE;
|
||||||
|
|
||||||
put_fd(descriptor);
|
put_fd(descriptor);
|
||||||
|
|
Loading…
Reference in New Issue