From stefan@fafoe.dyndns.org  Wed Feb 20 08:51:31 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 9E77237B400; Wed, 20 Feb 2002 08:51:30 -0800 (PST)
Received: by stefan.fafoe (Postfix, from userid 1001)
	id A09F2EA17; Wed, 20 Feb 2002 17:50:28 +0100 (CET)
Message-Id: <20020220165028.A09F2EA17@stefan.fafoe>
Date: Wed, 20 Feb 2002 17:50:28 +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: freebsd-emulation@freebsd.org
Subject: [PATCH] Two little fixes
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         35147
>Category:       i386
>Synopsis:       [PATCH] Two little fixes
>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:   Wed Feb 20 09:00:00 PST 2002
>Closed-Date:    Tue Feb 26 02:24:45 PST 2002
>Last-Modified:  Tue Feb 26 02:31:36 PST 2002
>Originator:     Stefan Farfeleder
>Release:        FreeBSD CURRENT
>Organization:
>Environment:
System: FreeBSD stefan.fafoe 4.5-STABLE FreeBSD 4.5-STABLE #5: Sun Feb 17 00:06:38 CET 2002 root@stefan.fafoe:/usr/obj/usr/src/sys/MORDOR i386


	
>Description:
The first patch fixes the emulation of machine instructions with the 'rep'
prefix. The code failed to set the cx register to 0.

The second one tries to avoid a seg-fault when a dos programs calls int 10h
function 0. If doscmd wasn't invoked with -x, it will currently dump core at
tty.c:2201 in the call to XAllocColor because dpy is NULL.
	
>How-To-Repeat:
	
>Fix:

Index: src/usr.bin/doscmd/cpu.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/doscmd/cpu.c,v
retrieving revision 1.5
diff -u -r1.5 cpu.c
--- src/usr.bin/doscmd/cpu.c	2 Dec 2001 13:44:05 -0000	1.5
+++ src/usr.bin/doscmd/cpu.c	20 Feb 2002 16:44:36 -0000
@@ -276,6 +276,7 @@
 		R_IP = --ip;	/* Move IP back to the 'rep' instruction. */
 		return -1;
 	    }
+	    R_CX = 0;
 	    break;
 	default:
 	    /* Unknown instruction, get out of here and let trap.c:sigbus()
Index: src/usr.bin/doscmd/int10.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/doscmd/int10.c,v
retrieving revision 1.6
diff -u -r1.6 int10.c
--- src/usr.bin/doscmd/int10.c	12 Oct 2001 10:31:00 -0000	1.6
+++ src/usr.bin/doscmd/int10.c	20 Feb 2002 16:44:13 -0000
@@ -56,6 +56,8 @@
 
 	switch (R_AH) {
 	case 0x00:		/* Set display mode */
+		if (!xmode)
+			goto unsupported;
 		init_mode(R_AL);
 		break;
 	case 0x01:		/* Define cursor */
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: robert 
State-Changed-When: Tue Feb 26 02:24:45 PST 2002 
State-Changed-Why:  
Committed, thanks! 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=35147 
>Unformatted:
