os_query_stackBottom() how does it work?
Chad J
"gamerChad\" at spamIsBad gmail.com
Sun May 7 20:47:57 PDT 2006
I've run into this while trying to port GPhobos to the arm-wince
(PocketPC) platform. Never mind that it's GPhobos though, it's the same
function in dmd Phobos, Ares too.
It looks like this:
/**********************************************
* Determine "bottom" of stack (actually the top on Win32 systems).
*/
void *os_query_stackBottom()
{
asm
{
naked ;
mov EAX,FS:4 ;
ret ;
}
}
I hit it while compiling std/thread.d, but I've also found it in
internal/gc/win32.d.
I'm wondering how to do this without using assembly, or if assembly is
necessary then how I might do it in ARM assembly. I'd probably be on my
way just to have some background knowledge about this though. Knowledge
like, what exactly is the stack bottom? Is it the place you reach when
you run out of stack memory or when you first start using the stack?
Something else? At least a link to some info would help.
It would be better though if someone knew how to do this using
Win32/WinCE programming, and could show me that.
Google hasn't helped me much in determining how that code works, but it
did yield some possibly useful information about WinCE memory architecture:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcemain4/html/_wcesdk_Windows_CE_Memory_Architecture.asp
clicking "stack" at the bottom of that page leads to:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcemain4/html/_wcesdk_the_stack.asp
This might also help:
http://blogs.msdn.com/kitlfirst/
searching WinCE API for "CreateThread" found in above article yields:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesdkr/html/wce30oriWindowsCE30APIReference.asp
Anyhow I might be able to improvise something using info from those
links, but I am not sure what's happening on the Phobos side of things.
Please help.
More information about the D.gnu
mailing list