Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751083AbVIFWmU (ORCPT ); Tue, 6 Sep 2005 18:42:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751084AbVIFWmU (ORCPT ); Tue, 6 Sep 2005 18:42:20 -0400 Received: from lmcgw.cs.sunysb.edu ([130.245.128.4]:15069 "EHLO smtp.lmc.cs.sunysb.edu") by vger.kernel.org with ESMTP id S1751083AbVIFWmT (ORCPT ); Tue, 6 Sep 2005 18:42:19 -0400 Date: Tue, 06 Sep 2005 18:42:17 -0400 From: Giridhar Pemmasani To: Daniel Phillips Cc: linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: RFC: i386: kill !4KSTACKS In-Reply-To: <200509061819.45567.phillips@istop.com> References: <20050904145129.53730.qmail@web50202.mail.yahoo.com> <58d0dbf10509061005358dce91@mail.gmail.com> <200509061819.45567.phillips@istop.com> User-Agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 MULE XEmacs/21.4 (patch 17) (Jumbo Shrimp) (i386-debian-linux) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Message-Id: <20050906224217.2FABFEF4D4@wolfe.lmc.cs.sunysb.edu> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1840 Lines: 44 On Tue, 6 Sep 2005 18:19:45 -0400, Daniel Phillips said: Daniel> There are only two stacks involved, the normal kernel stack Daniel> and your new ndis stack. You save ESP of the kernel stack Sadly, that is not the case: Some drivers, especially USB drivers, create multiple threads (those threads are created through ndiswrapper, so if any massaging needs to be done, ndiswrapper can do that). However, it is not multiple threads that is the problem, but switching of stacks. On transition from Windows function to Linux function, we need to copy the arguments that are in Windows stack into Linux stack so Linux function gets the arguments. We need to do same thing in the reverse direction. As mentioned before, this gets complicated with different calling conventions and different number of arguments to functions. Moreover, if Linux kernel decides to suspend a thread while it is executing Windows function, kernel sees an invalid stack. Daniel> You will allocate your own stack once on driver Daniel> initialization. Rather, whenever a new thread is created. Daniel> I missed something there. You would switch stacks before Daniel> calling the Windows code and after the Windows code calls Daniel> you (and respective returns) so you are always in your own Daniel> code when you switch, hence you know how to copy the Daniel> parameters. This is not impossible, but messy (even if the very idea ndiswrapper itself sounds scary to some). Daniel> By the way, I use ndis_wrapper, thanks a lot you guys! Good to know you are happy. -- Giri - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/