fixed address checking in ppc atomic functions.
fixed compilation on x86. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4361 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
#ifndef _KERNEL_ARCH_x86_CPU_H
|
#ifndef _KERNEL_ARCH_x86_CPU_H
|
||||||
#define _KERNEL_ARCH_x86_CPU_H
|
#define _KERNEL_ARCH_x86_CPU_H
|
||||||
|
|
||||||
|
#include <ktypes.h>
|
||||||
#include <arch/x86/thread_struct.h>
|
#include <arch/x86/thread_struct.h>
|
||||||
#include <arch/x86/descriptors.h>
|
#include <arch/x86/descriptors.h>
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <KernelExport.h>
|
#include <KernelExport.h>
|
||||||
|
|
||||||
|
#include <ktypes.h>
|
||||||
#include <user_atomic.h>
|
#include <user_atomic.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -105,7 +107,7 @@ user_atomic_set64(vint64 *value, int64 newValue)
|
|||||||
int64 oldValue;
|
int64 oldValue;
|
||||||
status = disable_interrupts();
|
status = disable_interrupts();
|
||||||
acquire_spinlock(&user_lock);
|
acquire_spinlock(&user_lock);
|
||||||
if ((addr)value < KERNEL_BASE || (addr)value > (KERNEL_TOP - 8))
|
if ((addr)value >= KERNEL_BASE && (addr)value <= KERNEL_TOP)
|
||||||
goto error;
|
goto error;
|
||||||
if (user_memcpy(&oldValue, value, 8) < 0)
|
if (user_memcpy(&oldValue, value, 8) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@@ -129,7 +131,7 @@ user_atomic_test_and_set64(vint64 *value, int64 newValue, int64 testAgainst)
|
|||||||
int64 oldValue;
|
int64 oldValue;
|
||||||
status = disable_interrupts();
|
status = disable_interrupts();
|
||||||
acquire_spinlock(&user_lock);
|
acquire_spinlock(&user_lock);
|
||||||
if ((addr)value < KERNEL_BASE || (addr)value > (KERNEL_TOP - 8))
|
if ((addr)value >= KERNEL_BASE && (addr)value <= KERNEL_TOP)
|
||||||
goto error;
|
goto error;
|
||||||
if (user_memcpy(&oldValue, value, 8) < 0)
|
if (user_memcpy(&oldValue, value, 8) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@@ -154,7 +156,7 @@ user_atomic_add64(vint64 *value, int64 addValue)
|
|||||||
int64 oldValue;
|
int64 oldValue;
|
||||||
status = disable_interrupts();
|
status = disable_interrupts();
|
||||||
acquire_spinlock(&user_lock);
|
acquire_spinlock(&user_lock);
|
||||||
if ((addr)value < KERNEL_BASE || (addr)value > (KERNEL_TOP - 8))
|
if ((addr)value >= KERNEL_BASE && (addr)value <= KERNEL_TOP)
|
||||||
goto error;
|
goto error;
|
||||||
if (user_memcpy(&oldValue, value, 8) < 0)
|
if (user_memcpy(&oldValue, value, 8) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@@ -179,7 +181,7 @@ user_atomic_and64(vint64 *value, int64 andValue)
|
|||||||
int64 oldValue;
|
int64 oldValue;
|
||||||
status = disable_interrupts();
|
status = disable_interrupts();
|
||||||
acquire_spinlock(&user_lock);
|
acquire_spinlock(&user_lock);
|
||||||
if ((addr)value < KERNEL_BASE || (addr)value > (KERNEL_TOP - 8))
|
if ((addr)value >= KERNEL_BASE && (addr)value <= KERNEL_TOP)
|
||||||
goto error;
|
goto error;
|
||||||
if (user_memcpy(&oldValue, value, 8) < 0)
|
if (user_memcpy(&oldValue, value, 8) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@@ -204,7 +206,7 @@ user_atomic_or64(vint64 *value, int64 orValue)
|
|||||||
int64 oldValue;
|
int64 oldValue;
|
||||||
status = disable_interrupts();
|
status = disable_interrupts();
|
||||||
acquire_spinlock(&user_lock);
|
acquire_spinlock(&user_lock);
|
||||||
if ((addr)value < KERNEL_BASE || (addr)value > (KERNEL_TOP - 8))
|
if ((addr)value >= KERNEL_BASE && (addr)value <= KERNEL_TOP)
|
||||||
goto error;
|
goto error;
|
||||||
if (user_memcpy(&oldValue, value, 8) < 0)
|
if (user_memcpy(&oldValue, value, 8) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@@ -229,7 +231,7 @@ user_atomic_read64(vint64 *value)
|
|||||||
int64 oldValue;
|
int64 oldValue;
|
||||||
status = disable_interrupts();
|
status = disable_interrupts();
|
||||||
acquire_spinlock(&user_lock);
|
acquire_spinlock(&user_lock);
|
||||||
if ((addr)value < KERNEL_BASE || (addr)value > (KERNEL_TOP - 8))
|
if ((addr)value >= KERNEL_BASE && (addr)value <= KERNEL_TOP)
|
||||||
goto error;
|
goto error;
|
||||||
if (user_memcpy(&oldValue, value, 8) < 0)
|
if (user_memcpy(&oldValue, value, 8) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
#include <ktypes.h>
|
|
||||||
#include <arch_cpu.h>
|
#include <arch_cpu.h>
|
||||||
#include <syscalls.h>
|
#include <syscalls.h>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user