mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-28 22:57:37 +00:00
63 lines
1.6 KiB
Diff
63 lines
1.6 KiB
Diff
--- ./memintercept-utils.c- 2005-02-17 16:59:56.000000000 -0500
|
|
+++ ./memintercept-utils.c 2005-07-11 10:02:08.000000000 -0400
|
|
@@ -30,6 +30,12 @@
|
|
|
|
#include "memintercept-utils.h"
|
|
|
|
+/* include atomic operations macros from glibc */
|
|
+#ifndef __KERNEL__
|
|
+#define __KERNEL__
|
|
+#endif
|
|
+#include <asm/atomic.h>
|
|
+
|
|
static int
|
|
write_all (int fd,
|
|
const void *buf,
|
|
@@ -264,30 +270,22 @@
|
|
uint32_t
|
|
mi_atomic_increment(uint32_t *addr)
|
|
{
|
|
-#if defined (__GNUC__) && defined (__i386__)
|
|
- uint32_t result;
|
|
- __asm__ __volatile__("lock; xaddl %0, %1; incl %0"
|
|
- : "=r"(result), "=m"(*(addr))
|
|
- : "0" (1), "m"(*(addr)) : "memory");
|
|
- return result;
|
|
+#if defined (__GNUC__)
|
|
+ return((uint32_t)atomic_inc_return((atomic_t *)addr));
|
|
#else
|
|
/* Hope for the best */
|
|
- return *++p;
|
|
+ return *++addr;
|
|
#endif
|
|
}
|
|
|
|
uint32_t
|
|
mi_atomic_decrement(uint32_t *addr)
|
|
{
|
|
-#if defined (__GNUC__) && defined (__i386__)
|
|
- uint32_t result;
|
|
- __asm__ __volatile__("lock; xaddl %0, %1; decl %0"
|
|
- : "=r"(result), "=m"(*(addr))
|
|
- : "0" (-1), "m"(*(addr)) : "memory");
|
|
- return result;
|
|
+#if defined (__GNUC__)
|
|
+ return((uint32_t)atomic_dec_return((atomic_t *)addr));
|
|
#else
|
|
/* Hope for the best */
|
|
- return *--p;
|
|
+ return *--addr;
|
|
#endif
|
|
}
|
|
|
|
--- ./stack-frame.c- 2005-02-17 17:02:22.000000000 -0500
|
|
+++ ./stack-frame.c 2005-02-17 17:02:37.000000000 -0500
|
|
@@ -69,7 +69,7 @@
|
|
|
|
#define HAVE_FRAME_ACCESSORS
|
|
|
|
-#if defined (__GNUC__) && defined (__i386__)
|
|
+#if defined (__GNUC__)
|
|
typedef struct stack_frame_struct stack_frame;
|
|
struct stack_frame_struct {
|
|
stack_frame *next;
|