lkml.org 
[lkml]   [2005]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: RFC: i386: kill !4KSTACKS

On Tue, 6 Sep 2005 18:19:45 -0400, Daniel Phillips <phillips@istop.com> 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/

\
 
 \ /
  Last update: 2005-09-07 00:45    [W:0.154 / U:0.684 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site