Did not compile before.
Fixed some style issues. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4955 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
280bc131fd
commit
c12bec104e
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include <KernelExport.h>
|
#include <KernelExport.h>
|
||||||
|
|
||||||
#include <ktypes.h>
|
#include <kernel.h>
|
||||||
#include <user_atomic.h>
|
#include <user_atomic.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -104,18 +104,19 @@ _user_atomic_set64(vint64 *value, int64 newValue)
|
|||||||
{
|
{
|
||||||
cpu_status status;
|
cpu_status status;
|
||||||
int64 oldValue;
|
int64 oldValue;
|
||||||
if (!CHECK_USER_ADDRESS(value))
|
if (!CHECK_USER_ADDRESS(value)
|
||||||
goto access_violation;
|
|| lock_memory((void *)value, 8, B_READ_DEVICE) != B_OK)
|
||||||
if (B_OK != lock_memory(value, 8, B_READ_DEVICE))
|
|
||||||
goto access_violation;
|
goto access_violation;
|
||||||
|
|
||||||
status = disable_interrupts();
|
status = disable_interrupts();
|
||||||
acquire_spinlock(&atomic_lock);
|
acquire_spinlock(&atomic_lock);
|
||||||
oldValue = *value;
|
oldValue = *value;
|
||||||
*value = newValue;
|
*value = newValue;
|
||||||
release_spinlock(&atomic_lock);
|
release_spinlock(&atomic_lock);
|
||||||
restore_interrupts(status);
|
restore_interrupts(status);
|
||||||
unlock_memory(value, 8, B_READ_DEVICE))
|
unlock_memory((void *)value, 8, B_READ_DEVICE);
|
||||||
return oldValue;
|
return oldValue;
|
||||||
|
|
||||||
access_violation:
|
access_violation:
|
||||||
// XXX kill application
|
// XXX kill application
|
||||||
return -1;
|
return -1;
|
||||||
@ -126,10 +127,10 @@ _user_atomic_test_and_set64(vint64 *value, int64 newValue, int64 testAgainst)
|
|||||||
{
|
{
|
||||||
cpu_status status;
|
cpu_status status;
|
||||||
int64 oldValue;
|
int64 oldValue;
|
||||||
if (!CHECK_USER_ADDRESS(value))
|
if (!CHECK_USER_ADDRESS(value)
|
||||||
goto access_violation;
|
|| lock_memory((void *)value, 8, B_READ_DEVICE) != B_OK)
|
||||||
if (B_OK != lock_memory(value, 8, B_READ_DEVICE))
|
|
||||||
goto access_violation;
|
goto access_violation;
|
||||||
|
|
||||||
status = disable_interrupts();
|
status = disable_interrupts();
|
||||||
acquire_spinlock(&atomic_lock);
|
acquire_spinlock(&atomic_lock);
|
||||||
oldValue = *value;
|
oldValue = *value;
|
||||||
@ -137,8 +138,9 @@ _user_atomic_test_and_set64(vint64 *value, int64 newValue, int64 testAgainst)
|
|||||||
*value = newValue;
|
*value = newValue;
|
||||||
release_spinlock(&atomic_lock);
|
release_spinlock(&atomic_lock);
|
||||||
restore_interrupts(status);
|
restore_interrupts(status);
|
||||||
unlock_memory(value, 8, B_READ_DEVICE))
|
unlock_memory((void *)value, 8, B_READ_DEVICE);
|
||||||
return oldValue;
|
return oldValue;
|
||||||
|
|
||||||
access_violation:
|
access_violation:
|
||||||
// XXX kill application
|
// XXX kill application
|
||||||
return -1;
|
return -1;
|
||||||
@ -149,18 +151,19 @@ _user_atomic_add64(vint64 *value, int64 addValue)
|
|||||||
{
|
{
|
||||||
cpu_status status;
|
cpu_status status;
|
||||||
int64 oldValue;
|
int64 oldValue;
|
||||||
if (!CHECK_USER_ADDRESS(value))
|
if (!CHECK_USER_ADDRESS(value)
|
||||||
goto access_violation;
|
|| lock_memory((void *)value, 8, B_READ_DEVICE) != B_OK)
|
||||||
if (B_OK != lock_memory(value, 8, B_READ_DEVICE))
|
|
||||||
goto access_violation;
|
goto access_violation;
|
||||||
|
|
||||||
status = disable_interrupts();
|
status = disable_interrupts();
|
||||||
acquire_spinlock(&atomic_lock);
|
acquire_spinlock(&atomic_lock);
|
||||||
oldValue = *value;
|
oldValue = *value;
|
||||||
*value += addValue;
|
*value += addValue;
|
||||||
release_spinlock(&atomic_lock);
|
release_spinlock(&atomic_lock);
|
||||||
restore_interrupts(status);
|
restore_interrupts(status);
|
||||||
unlock_memory(value, 8, B_READ_DEVICE))
|
unlock_memory((void *)value, 8, B_READ_DEVICE);
|
||||||
return oldValue;
|
return oldValue;
|
||||||
|
|
||||||
access_violation:
|
access_violation:
|
||||||
// XXX kill application
|
// XXX kill application
|
||||||
return -1;
|
return -1;
|
||||||
@ -171,18 +174,19 @@ _user_atomic_and64(vint64 *value, int64 andValue)
|
|||||||
{
|
{
|
||||||
cpu_status status;
|
cpu_status status;
|
||||||
int64 oldValue;
|
int64 oldValue;
|
||||||
if (!CHECK_USER_ADDRESS(value))
|
if (!CHECK_USER_ADDRESS(value)
|
||||||
goto access_violation;
|
|| lock_memory((void *)value, 8, B_READ_DEVICE) != B_OK)
|
||||||
if (B_OK != lock_memory(value, 8, B_READ_DEVICE))
|
|
||||||
goto access_violation;
|
goto access_violation;
|
||||||
|
|
||||||
status = disable_interrupts();
|
status = disable_interrupts();
|
||||||
acquire_spinlock(&atomic_lock);
|
acquire_spinlock(&atomic_lock);
|
||||||
oldValue = *value;
|
oldValue = *value;
|
||||||
*value &= andValue;
|
*value &= andValue;
|
||||||
release_spinlock(&atomic_lock);
|
release_spinlock(&atomic_lock);
|
||||||
restore_interrupts(status);
|
restore_interrupts(status);
|
||||||
unlock_memory(value, 8, B_READ_DEVICE))
|
unlock_memory((void *)value, 8, B_READ_DEVICE);
|
||||||
return oldValue;
|
return oldValue;
|
||||||
|
|
||||||
access_violation:
|
access_violation:
|
||||||
// XXX kill application
|
// XXX kill application
|
||||||
return -1;
|
return -1;
|
||||||
@ -193,17 +197,17 @@ _user_atomic_or64(vint64 *value, int64 orValue)
|
|||||||
{
|
{
|
||||||
cpu_status status;
|
cpu_status status;
|
||||||
int64 oldValue;
|
int64 oldValue;
|
||||||
if (!CHECK_USER_ADDRESS(value))
|
if (!CHECK_USER_ADDRESS(value)
|
||||||
goto access_violation;
|
|| lock_memory((void *)value, 8, B_READ_DEVICE) != B_OK)
|
||||||
if (B_OK != lock_memory(value, 8, B_READ_DEVICE))
|
|
||||||
goto access_violation;
|
goto access_violation;
|
||||||
|
|
||||||
status = disable_interrupts();
|
status = disable_interrupts();
|
||||||
acquire_spinlock(&atomic_lock);
|
acquire_spinlock(&atomic_lock);
|
||||||
oldValue = *value;
|
oldValue = *value;
|
||||||
*value |= orValue;
|
*value |= orValue;
|
||||||
release_spinlock(&atomic_lock);
|
release_spinlock(&atomic_lock);
|
||||||
restore_interrupts(status);
|
restore_interrupts(status);
|
||||||
unlock_memory(value, 8, B_READ_DEVICE))
|
unlock_memory((void *)value, 8, B_READ_DEVICE);
|
||||||
return oldValue;
|
return oldValue;
|
||||||
access_violation:
|
access_violation:
|
||||||
// XXX kill application
|
// XXX kill application
|
||||||
@ -215,17 +219,18 @@ _user_atomic_get64(vint64 *value)
|
|||||||
{
|
{
|
||||||
cpu_status status;
|
cpu_status status;
|
||||||
int64 oldValue;
|
int64 oldValue;
|
||||||
if (!CHECK_USER_ADDRESS(value))
|
if (!CHECK_USER_ADDRESS(value)
|
||||||
goto access_violation;
|
|| lock_memory((void *)value, 8, B_READ_DEVICE) != B_OK)
|
||||||
if (B_OK != lock_memory(value, 8, B_READ_DEVICE))
|
|
||||||
goto access_violation;
|
goto access_violation;
|
||||||
|
|
||||||
status = disable_interrupts();
|
status = disable_interrupts();
|
||||||
acquire_spinlock(&atomic_lock);
|
acquire_spinlock(&atomic_lock);
|
||||||
oldValue = *value;
|
oldValue = *value;
|
||||||
release_spinlock(&atomic_lock);
|
release_spinlock(&atomic_lock);
|
||||||
restore_interrupts(status);
|
restore_interrupts(status);
|
||||||
unlock_memory(value, 8, B_READ_DEVICE))
|
unlock_memory((void *)value, 8, B_READ_DEVICE);
|
||||||
return oldValue;
|
return oldValue;
|
||||||
|
|
||||||
access_violation:
|
access_violation:
|
||||||
// XXX kill application
|
// XXX kill application
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user