[mod.os.os9] OS-9 Discussions, V2 #9

os9@cbosgd.att.com (01/07/87)

OS-9 Discussions         Wednesday, January 7th 1987         Volume 2 : Issue 9

Today's Topics:

                          stack usage in device drivers

--------------------------------------------------------------------------

Date:  6 Jan 1987 1345-CST (Tuesday)
From: sun!mcrware!jejones (James Jones)
Subject: stack usage in device drivers

[The following is a reply to a query about stack usage in device drivers.
The author of the query, exunido!res (Ralf Stranzenbach), felt that the
answer would be of general interest, so I forward it to mod.os.os9 as well
as to him...James Jones]

------- Forwarded Message

In system state OS-9/68k only reserves about 2K of stack.  Everything in
the kernel, FMs, etc. are very stack conservative.  Just a few temps,
register saves and return addresses appear there.

If a driver intends to use a lot of stack, you should consider whether
the stack should really be used.  Normally, driver code is not recursively
or indirectly re-entered so there is really no need to keep massive stuff
on the stack.  Remember that if the driver sleeps with a big hunk of stack
swallowed, that could be asking for trouble.

My rule of thumb is to reserve the space in driver static storage if the
amount is under 1K.  If the data is over 1K or large or transient in nature,
do an F$SrqMem to request the memory from the system.  This should eliminate
any question of stack overusage.
------- End of Forwarded Message

 
-------------------------------------
The views expressed in OS-9 Discussions are those of the individual authors
only.
------
Moderator:  John Daleske   cbosgd!cbdkc1!daleske    daleske@cbdkc1.ATT.COM

Submissions should go to   cbosgd!os9               os9@cbosgd.ATT.COM
Comments to the moderator
 or to join the mailing    cbosgd!os9-request       os9-request@cbosgd.ATT.COM
 list.

*********************
End of OS-9 Discussions
*********************