Subject: Re: Need help from core-knowing people
To: Chris G Demetriou <Chris_G_Demetriou@LAGAVULIN.PDL.CS.CMU.EDU>
From: Michael L. Hitch <>
List: amiga
Date: 01/23/1995 08:45:27
On Jan 22,  9:05pm, Chris G Demetriou wrote:
> > My problem is:
> > st_mode_sense gives my Fastlane driver a buffer which is located on some
> > process' stack (&mode_sense I think) but when my driver (which is interrupt
> > driven almost always) gets to the data in phase I find that the virtual
> > to physical mapping has changed! My suspicion is that a process switch
> > has occured and with that, the interrupt routine runs on a diffrent stack
> > => The data gets transfered to an illegal adress.
> the solution is very simple:
> NEVER, EVER allocate data structures that may be accessed at interrupt
> time on a per-process stack.
> there's a reason that 'malloc' exists in the kernel.  8-)

  Hmm - it looks like someone needs to do some cleanup in the sys/scsi/*
stuff then.  There are a number of places where commands & buffers are
being allocated as local variables on the stack.  Since the high-level
scsi code doesn't have any way to know if the low-level driver needs to
access the command or data from the interrupt handler.


Michael L. Hitch			INTERNET:
Computer Consultant
Office of Systems and Computing Services
Montana State University	Bozeman, MT	USA