From owner-freebsd-emulation@FreeBSD.ORG Tue Jul 8 14:06:52 2003 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 44FCD37B401; Tue, 8 Jul 2003 14:06:52 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id EAC4243F3F; Tue, 8 Jul 2003 14:06:51 -0700 (PDT) (envelope-from julian@FreeBSD.org) Received: from freefall.freebsd.org (julian@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h68L6pUp061229; Tue, 8 Jul 2003 14:06:51 -0700 (PDT) (envelope-from julian@freefall.freebsd.org) Received: (from julian@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h68L6pKH061228; Tue, 8 Jul 2003 14:06:51 -0700 (PDT) Date: Tue, 8 Jul 2003 14:06:51 -0700 (PDT) From: Julian Elischer Message-Id: <200307082106.h68L6pKH061228@freefall.freebsd.org> To: current@FreeBSD.org cc: emulation@FreeBSD.org Subject: LDT entries and WINE and Threads.. X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2003 21:06:52 -0000 I'm looking at this and I think that my interpretation is that WINE, under FreeBSD, blindly allocates LDT entries starting at location 17, without looking to see if they are in use already.. My reason for thinking thios is that the string i386_get_ldt only occurs once in the WINE source, and that is a prototype declaration in ./work/wine-20030508/libs/wine/ldt.c (in the port) In other words, it is not checking first.. This makes it "incompatible" with threads (both libthr and libkse) and while this isn't an immediate problem, it WILL be a problem because WINE uses OpenGL and OpenGL used threads (currently linuxthreads) so it will eventually be a problem.. It seems to me that we could better serve the applications by having a differnt API for setting LDTs, and that the kernel should keep track of which is free and which is not. I would say that the API should be something like: int selector = i386_make_ldte(type, base, limit, flags); where "selector" is what you later stuff into a segment register. there would be an equivalent void i386_free_ldte(selector) i386_get_ldt() could stay as it is I think.. The 'guts' of i386_make_ldte would be used directly by kse_create() and set the value of %gs that the upcall returns with. comments?