diff --git a/headers/private/kernel/arch/x86/arch_cpu.h b/headers/private/kernel/arch/x86/arch_cpu.h index 3596edf7b6..c80e856b5d 100644 --- a/headers/private/kernel/arch/x86/arch_cpu.h +++ b/headers/private/kernel/arch/x86/arch_cpu.h @@ -5,6 +5,7 @@ #ifndef _KERNEL_ARCH_x86_CPU_H #define _KERNEL_ARCH_x86_CPU_H +#include #include #include diff --git a/src/kernel/core/arch/ppc/arch_atomic.c b/src/kernel/core/arch/ppc/arch_atomic.c index f2cc4a1d74..69743c5483 100644 --- a/src/kernel/core/arch/ppc/arch_atomic.c +++ b/src/kernel/core/arch/ppc/arch_atomic.c @@ -4,6 +4,8 @@ */ #include + +#include #include /* @@ -105,7 +107,7 @@ user_atomic_set64(vint64 *value, int64 newValue) int64 oldValue; status = disable_interrupts(); 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; if (user_memcpy(&oldValue, value, 8) < 0) goto error; @@ -129,7 +131,7 @@ user_atomic_test_and_set64(vint64 *value, int64 newValue, int64 testAgainst) int64 oldValue; status = disable_interrupts(); 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; if (user_memcpy(&oldValue, value, 8) < 0) goto error; @@ -154,7 +156,7 @@ user_atomic_add64(vint64 *value, int64 addValue) int64 oldValue; status = disable_interrupts(); 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; if (user_memcpy(&oldValue, value, 8) < 0) goto error; @@ -179,7 +181,7 @@ user_atomic_and64(vint64 *value, int64 andValue) int64 oldValue; status = disable_interrupts(); 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; if (user_memcpy(&oldValue, value, 8) < 0) goto error; @@ -204,7 +206,7 @@ user_atomic_or64(vint64 *value, int64 orValue) int64 oldValue; status = disable_interrupts(); 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; if (user_memcpy(&oldValue, value, 8) < 0) goto error; @@ -229,7 +231,7 @@ user_atomic_read64(vint64 *value) int64 oldValue; status = disable_interrupts(); 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; if (user_memcpy(&oldValue, value, 8) < 0) goto error; diff --git a/src/kernel/libroot/os/atomic.c b/src/kernel/libroot/os/atomic.c index 32b415898c..25798dbf9c 100644 --- a/src/kernel/libroot/os/atomic.c +++ b/src/kernel/libroot/os/atomic.c @@ -5,7 +5,6 @@ #include -#include #include #include