From stefan@fafoe.dyndns.org  Fri Mar  1 01:51:12 2002
Return-Path: <stefan@fafoe.dyndns.org>
Received: from fafoe.dyndns.org (chello212186121237.14.vie.surfer.at [212.186.121.237])
	by hub.freebsd.org (Postfix) with ESMTP id 0D54637B405
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  1 Mar 2002 01:51:12 -0800 (PST)
Received: by stefan.fafoe (Postfix, from userid 1001)
	id C3F4CEA1B; Fri,  1 Mar 2002 10:50:13 +0100 (CET)
Message-Id: <20020301095013.C3F4CEA1B@stefan.fafoe>
Date: Fri,  1 Mar 2002 10:50:13 +0100 (CET)
From: Stefan Farfeleder <e0026813@stud3.tuwien.ac.at>
Reply-To: Stefan Farfeleder <e0026813@stud3.tuwien.ac.at>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] another small fix for doscmd
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         35449
>Category:       i386
>Synopsis:       [PATCH] another small fix for doscmd
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 01 02:00:02 PST 2002
>Closed-Date:    Tue May 21 04:53:11 PDT 2002
>Last-Modified:  Tue May 21 04:53:11 PDT 2002
>Originator:     Stefan Farfeleder
>Release:        FreeBSD 4.5-STABLE i386
>Organization:
>Environment:
System: FreeBSD stefan.fafoe 4.5-STABLE FreeBSD 4.5-STABLE #8: Tue Feb 26 21:34:20 CET 2002 root@stefan.fafoe:/usr/obj/usr/src/sys/MORDOR i386


	
>Description:
HandleIO() wants to pass a pointer to a regcontext_t (which is a union of a
mcontext_t and a registers_t) to a handler but fails to do so because it casts
the address of the whole ucontext_t instead of its member uc_mcontext (there is
a sigset_t uc_sigmask in at the beginning of a ucontext_t).

>How-To-Repeat:
It is rather hard to see any failure at all since the most handlers
(video_async_event, _kbd_event and com_async) do not use the parameter REGS. I
found the bug when I was adding some code for a mouse callback routine to
video_event and the eax register changed in the sigframe though I changed R_CS.
>Fix:

Index: AsyncIO.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/doscmd/AsyncIO.c,v
retrieving revision 1.7
diff -u -r1.7 AsyncIO.c
--- AsyncIO.c	2 Oct 2001 11:28:59 -0000	1.7
+++ AsyncIO.c	1 Mar 2002 09:00:01 -0000
@@ -246,7 +246,7 @@
 		 */
 		if (as->func) {
 			(*handlers[fd].func)(fd, cond, handlers[fd].arg, 
-			    (regcontext_t*)&sf->sf_uc);
+			    (regcontext_t*)&sf->sf_uc.uc_mcontext);
 		} else {
 			/*
 			 * Otherwise deregister this guy.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: tg 
State-Changed-When: Tue May 21 04:52:39 PDT 2002 
State-Changed-Why:  
Committed to -current and -stable. Thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=35449 
>Unformatted:
