From tlp@LiquidX.org  Tue Nov 23 21:40:29 2004
Return-Path: <tlp@LiquidX.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id B67C016A4CF
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 23 Nov 2004 21:40:29 +0000 (GMT)
Received: from smtpauth.kewlio.net (smtpauth.kewlio.net [195.22.134.25])
	by mx1.FreeBSD.org (Postfix) with ESMTP id E480C43D4C
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 23 Nov 2004 21:40:28 +0000 (GMT)
	(envelope-from tlp@LiquidX.org)
Received: from maya.liquidx.org (70-56-157-27.bois.qwest.net [70.56.157.27])
	(authenticated bits=0)
	by smtpauth.kewlio.net (8.12.10/8.12.10) with ESMTP id iANLeOdk003392
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 23 Nov 2004 21:40:27 GMT
Message-Id: <20041123144038.43d6f9c5@maya.liquidx.org>
Date: Tue, 23 Nov 2004 14:40:38 -0700
From: Travis Poppe <tlp@LiquidX.org>
To: FreeBSD-gnats-submit@freebsd.org
Subject: [PATCH] Our Linux binary support does not appear to be handling UNIMPL syscalls correctly,

>Number:         74302
>Category:       kern
>Synopsis:       [PATCH] Our Linux binary support does not appear to be handling UNIMPL syscalls correctly, causing at least one application to crash.
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    emulation
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 23 21:50:21 GMT 2004
>Closed-Date:    Mon Mar 07 00:25:44 GMT 2005
>Last-Modified:  Mon Mar 07 00:25:44 GMT 2005
>Originator:     Travis Poppe <tlp@LiquidX.org>
>Release:        
>Organization:
>Environment:
>Description:
Our Linux compatibility module does not appear to be handling UNIMPL
syscalls correctly, causing at least one application (Cedega, aka WineX)
to crash on start. 

To the best of Peter Hunnisett's knowledge (peter@transgaming.com), the
default behavior should be to return ENOSYS for an UNIMPL syscall. This
is how Linux behaves. The following patch effectively does this and
corrects Cedega from crashing at start. It is now possible to run a few
Windows games using Cedega (Linux version) with this patch.

Without this patch, FreeBSD sends a signal and _then_ returns ENOSYS.

Coded by: Peter Hunnisett (peter@transgaming.com)
Tested by: Travis Poppe (tlp@liquidx.org)
>How-To-Repeat:
>Fix:
--- linux_sysproto.h.orig	Tue Nov 23 13:13:33 2004
+++ linux_sysproto.h	Tue Nov 23 13:13:33 2004
@@ -0,0 +1,7 @@
+#ifndef LINUX_EMUL_PROTO
+#define LINUX_EMUL_PROTO
+
+int linux_nosys( struct thread* td, struct nosys_args* ignore );
+#define nosys linux_nosys
+
+#endif /* LINUX_EMUL_PROTO */
--- linux_sysvec.c.orig	Thu Jul 15 01:26:05 2004
+++ linux_sysvec.c	Tue Nov 23 13:13:33 2004
@@ -188,6 +188,13 @@
      _bsd_to_linux_trapcode[(code)]: \
      LINUX_T_UNKNOWN)
 
+int linux_nosys( struct thread* td, struct nosys_args* ignore )
+{
+	return (ENOSYS);
+}
+
+
+
 /*
  * If FreeBSD & Linux have a difference of opinion about what a trap
  * means, deal with it here.
--- syscalls.master.orig	Tue Nov 23 13:12:37 2004
+++ syscalls.master	Tue Nov 23 13:12:57 2004
@@ -27,6 +27,7 @@
 #include <sys/sysproto.h>
 #include <i386/linux/linux.h>
 #include <i386/linux/linux_proto.h>
+#include <i386/linux/linux_sysproto.h>
 
 ; #ifdef's, etc. may be included, and are copied to the output files.
 

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->emulation 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Nov 29 09:26:38 GMT 2004 
Responsible-Changed-Why:  
Reassign to appropriate mailing list. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=74302 
State-Changed-From-To: open->closed 
State-Changed-By: sobomax 
State-Changed-When: Mon Mar 7 00:25:16 GMT 2005 
State-Changed-Why:  
iRelevant change has been committed to 6-CURRENT, thank you for reporting! 

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