TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Jonathan de Boyne Pollard
from: Vitus Jensen
date: 1998-10-09 23:32:10
subject: How do DLLs load and unload ?

Hello Jonathan,

06.10.98 09:14, Jonathan de Boyne Pollard wrote a message to Denis Tonn:

(sorry to fill in but i think i've got a point to make)

...
 DT>>  It doesn't operate with a kernel stack during the callback. It
 DT>> operates with the Ring 3 stack. If the process/thread stack 
 DT>> overflows, normal exception processing applies. 

 JdBP> You haven't thought about the kernel stack.  When the first
 JdBP> call to DosLoadModule or DosFreeModule calls the InitTerm
 JdBP> function in ring 3, it is several stack frames deep on the
 JdBP> kernel stack.  Even though the stack switches to the user stack
 JdBP> for the ring 3 callback, these stack frames on the kernel stack
 JdBP> *do not go away*.  They are there for the kernel to continue. 
 JdBP> When a nested DosLoadModule or DosFreeModule happens in the
 JdBP> InitTerm function, *further* stack frames are pushed onto the
 JdBP> kernel stack.  It is obvious that eventually the kernel stack
 JdBP> is going to overflow if this is nested enough times.  

Doing the second switch from ring 3 to ring 0 isn't a recursion as this has
to be done via a task state segment and a TSS holds the start values for
SS:ESP (ring 2,1,0).

 JdBP> So to add the emphasis to the question I asked above:  How does
 JdBP> the kernel deal with the *kernel stack* overflow issue that
 JdBP> results ?
...

There may be other problems because of the TSS design but IMHO not because
there are stack overflows as you described them.

C-x C-s
    Vitus

Team OS/2 Germany #835, Fidonet, OS2Net, FAX/BBS: +49-05136-893003, ...
--- Sqed/rexx 482:
* Origin: My best view from a Window was through OS/2. (2:2474/424.1)
SEEN-BY: 396/1 632/0 371 633/210 260 267 270 371 635/506 728 639/252 670/218
@PATH: 2474/424 400 200 2613/404 5 140/1 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.