Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
To: Jean-Baptiste Vignaud <jbv@club-internet.fr>,
	Richard Henderson <rth@twiddle.net>
Cc: axp-list <axp-list@redhat.com>
Subject: Re: 2.3.x broken
Date: Mon, 17 May 1999 22:01:21 +0400	[thread overview]
Message-ID: <19990517220121.A10751@jurassic.park.msu.ru> (raw)
In-Reply-To: <000001bea046$0581cc60$cc000001@PC_VIGNAUD.xandmail.com>; from Jean-Baptiste Vignaud on Mon, May 17, 1999 at 11:17:01AM +0200

On Mon, May 17, 1999 at 11:17:01AM +0200, Jean-Baptiste Vignaud wrote:
> 
> I'v downloaded the 2.2.8->2.3.0, 2.3.1 and 2.3.2 patches and the compilation
> (redhat/sx164)  fails for
> 2.3.1 and 2.3.2 in semaphore.h.
> 

Here is the patch against 2.3.3. It compiles, though I haven't boot it.

Ivan

diff -ur linux-2.3.3/arch/alpha/kernel/process.c linux/arch/alpha/kernel/process.c
--- linux-2.3.3/arch/alpha/kernel/process.c	Fri May 14 23:41:23 1999
+++ linux/arch/alpha/kernel/process.c	Mon May 17 21:14:46 1999
@@ -58,10 +58,10 @@
 static struct file * init_fd_array[NR_OPEN] = { NULL, };
 static struct files_struct init_files = INIT_FILES;
 static struct signal_struct init_signals = INIT_SIGNALS;
-struct mm_struct init_mm = INIT_MM;
+struct mm_struct init_mm = INIT_MM(init_mm);
 
 union task_union init_task_union __attribute__((section("init_task")))
-	 = { task: INIT_TASK };
+	 = { task: INIT_TASK(init_task_union.task) };
 
 /*
  * No need to acquire the kernel lock, we're entirely local..
diff -ur linux-2.3.3/include/asm-alpha/semaphore.h linux/include/asm-alpha/semaphore.h
--- linux-2.3.3/include/asm-alpha/semaphore.h	Sun May 16 02:05:37 1999
+++ linux/include/asm-alpha/semaphore.h	Mon May 17 21:09:19 1999
@@ -11,20 +11,63 @@
 #include <asm/current.h>
 #include <asm/system.h>
 #include <asm/atomic.h>
+#include <linux/wait.h>
 
 struct semaphore {
 	/* Careful, inline assembly knows about the position of these two.  */
 	atomic_t count;
 	atomic_t waking;		/* biased by -1 */
 	wait_queue_head_t wait;
+#if WAITQUEUE_DEBUG
+	long __magic;
+#endif
 };
 
-#define MUTEX ((struct semaphore) \
- { ATOMIC_INIT(1), ATOMIC_INIT(-1), NULL })
-#define MUTEX_LOCKED ((struct semaphore) \
- { ATOMIC_INIT(0), ATOMIC_INIT(-1), NULL })
+#if WAITQUEUE_DEBUG
+# define __SEM_DEBUG_INIT(name) \
+		, (long)&(name).__magic
+#else
+# define __SEM_DEBUG_INIT(name)
+#endif
+
+#define __SEMAPHORE_INITIALIZER(name,count) \
+{ ATOMIC_INIT(count), ATOMIC_INIT(-1), __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \
+	__SEM_DEBUG_INIT(name) }
+
+#define __MUTEX_INITIALIZER(name) \
+	__SEMAPHORE_INITIALIZER(name,1)
 
-#define sema_init(sem, val)	atomic_set(&((sem)->count), val)
+#define __DECLARE_SEMAPHORE_GENERIC(name,count) \
+	struct semaphore name = __SEMAPHORE_INITIALIZER(name,count)
+
+#define DECLARE_MUTEX(name) __DECLARE_SEMAPHORE_GENERIC(name,1)
+#define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
+
+extern inline void sema_init (struct semaphore *sem, int val)
+{
+/*
+ *	*sem = (struct semaphore)__SEMAPHORE_INITIALIZER((*sem),val);
+ *
+ * i'd rather use the more flexible initialization above, but sadly
+ * GCC 2.7.2.3 emits a bogus warning. EGCS doesnt. Oh well.
+ */
+	atomic_set(&sem->count, val);
+	atomic_set(&sem->waking, -1);
+	init_waitqueue_head(&sem->wait);
+#if WAITQUEUE_DEBUG
+	sem->__magic = (long)&sem->__magic;
+#endif
+}
+
+static inline void init_MUTEX (struct semaphore *sem)
+{
+	sema_init(sem, 1);
+}
+
+static inline void init_MUTEX_LOCKED (struct semaphore *sem)
+{
+	sema_init(sem, 0);
+}
 
 extern void __down(struct semaphore * sem);
 extern int  __down_interruptible(struct semaphore * sem);
@@ -59,6 +102,10 @@
 	   the linker.  */
 	register void *pv __asm__("$27") = __down_failed;
 	
+#if WAITQUEUE_DEBUG
+	CHECK_MAGIC(sem->__magic);
+#endif
+
 	__asm__ __volatile__ (
 		"/* semaphore down operation */\n"
 		"1:	ldl_l	$24,%1\n"
@@ -90,6 +137,9 @@
 	register int ret __asm__("$24");
 	register void *pv __asm__("$27") = __down_failed_interruptible;
 
+#if WAITQUEUE_DEBUG
+	CHECK_MAGIC(sem->__magic);
+#endif
 	__asm__ __volatile__ (
 		"/* semaphore down interruptible operation */\n"
 		"1:	ldl_l	$24,%2\n"
@@ -125,6 +175,9 @@
 {
 	long ret, tmp, tmp2, sub;
 
+#if WAITQUEUE_DEBUG
+	CHECK_MAGIC(sem->__magic);
+#endif
 	/* "Equivalent" C.  Note that we have to do this all without
 	   (taken) branches in order to be a valid ll/sc sequence.
 
@@ -181,6 +234,9 @@
 
 	register void *pv __asm__("$27") = __up_wakeup;
 
+#if WAITQUEUE_DEBUG
+	CHECK_MAGIC(sem->__magic);
+#endif
 	__asm__ __volatile__ (
 		"/* semaphore up operation */\n"
 		"	mb\n"


  reply	other threads:[~1999-05-17 18:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-17  9:17 2.3.x broken Jean-Baptiste Vignaud
1999-05-17 18:01 ` Ivan Kokshaysky [this message]
1999-05-18  7:14   ` Vignaud Jean-Baptiste
1999-05-28  2:30   ` Robert Bowles
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox