[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

KSE: fuword/suword bugs on ia64



Ok,

I've started runtime testing and ran into ILP32/LP64 bugs. Attached
a patch that solve the first problems without affecting i386. The
patch is intended to illustrate the problem more than it suggest a
solution. I'm more than happy to test alternative solutions.
Note that the use of uint32_t instead of unsigned int is mostly
to mirror the use of fuword32/suword32...

FYI,

-- 
 Marcel Moolenaar	  USPA: A-39004		 marcel_(_at_)_xcllnt_(_dot_)_net
-------------- next part --------------
Index: kern/kern_thread.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_thread.c,v
retrieving revision 1.145
diff -u -r1.145 kern_thread.c
--- kern/kern_thread.c	20 Jun 2003 09:12:12 -0000	1.145
+++ kern/kern_thread.c	28 Jun 2003 05:12:23 -0000
@@ -958,8 +958,8 @@
 
 	/* Exports clock ticks in kernel mode */
 	addr = (caddr_t)(&td->td_mailbox->tm_sticks);
-	temp = fuword(addr) + td->td_usticks;
-	if (suword(addr, temp)) {
+	temp = fuword32(addr) + td->td_usticks;
+	if (suword32(addr, temp)) {
 		error = EFAULT;
 		goto bad;
 	}
@@ -1096,7 +1096,7 @@
 		addr = (caddr_t)&tmbx->tm_sticks;
 	}
 	if (uticks) {
-		if (suword(addr, uticks+fuword(addr))) {
+		if (suword32(addr, uticks+fuword32(addr))) {
 			PROC_LOCK(p);
 			psignal(p, SIGSEGV);
 			PROC_UNLOCK(p);
@@ -1518,7 +1518,7 @@
 		KASSERT(ku, ("%s: no upcall owned", __func__));
 		KASSERT((ku->ku_owner == td), ("%s: wrong owner", __func__));
 		KASSERT(!TD_CAN_UNBIND(td), ("%s: can unbind", __func__));
-		ku->ku_mflags = fuword((void *)&ku->ku_mailbox->km_flags);
+		ku->ku_mflags = fuword32((void *)&ku->ku_mailbox->km_flags);
 		tmbx = (void *)fuword((void *)&ku->ku_mailbox->km_curthread);
 		if ((tmbx == NULL) || (tmbx == (void *)-1)) {
 			td->td_mailbox = NULL;
Index: sys/kse.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/kse.h,v
retrieving revision 1.15
diff -u -r1.15 kse.h
--- sys/kse.h	15 Jun 2003 12:51:26 -0000	1.15
+++ sys/kse.h	28 Jun 2003 05:12:37 -0000
@@ -57,9 +57,9 @@
 	unsigned int		tm_flags;	/* Thread flags */
 	struct kse_thr_mailbox	*tm_next;	/* Next thread in list */
 	void			*tm_udata;	/* For use by the UTS */
-	unsigned int		tm_uticks;
-	unsigned int		tm_sticks;
-	int			tm_spare[8];
+	uint32_t		tm_uticks;
+	uint32_t		tm_sticks;
+	uint32_t		tm_spare[8];
 };
 
 /*
@@ -73,7 +73,7 @@
 	struct kse_thr_mailbox	*km_curthread;	/* Currently running thread */
 	struct kse_thr_mailbox	*km_completed;	/* Threads back from kernel */
 	sigset_t		km_sigscaught;	/* Caught signals */
-	unsigned int		km_flags;	/* KSE flags */
+	uint32_t		km_flags;	/* KSE flags */
 	kse_func_t		*km_func;	/* UTS function */
 	stack_t			km_stack;	/* UTS context */
 	void			*km_udata;	/* For use by the UTS */