[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problem with do_wakeup_things



During the development of an interruptdriven ICD/ACSI driver for Erling
Henangers ehscsi I stumpled about a problem with do_wakup_things.
First, some code-examples to get the neccessary background:

--- SCSIDEV ---:

> interruptroutine(long stat) {
>  status = (short) stat;
>   fake_timeout=ADDROOTTIMEOUT(0l,wake_process,1); /* This is in an */
> }                               /* Interrupt, so set the "int" bit. */
> 
> void wake_process(void) {
>   remove_interrupt();
>   interrupt_done=1l;
>   CANCELROOTTIMEOUT(the_timeout);
>   WAKE(IO_Q, WAKEMAGIC);
>   ... (some internal queue-management)
> }
>                                 
> long do_reading_command(SCSI_COMMAND *cmd) {
>   long proc;
>   long error;
>   interrupt_done=0l;
>   ... (deleted stuff to poll if p_getpid == 0)
>   WAKEMAGIC=(long)cmd;
>   error=do_scsi(cmd->device&0x7,cmd->cmdlen,
>                 cmd->transferlen,SCSI_READ, cmd->cmdblk,cmd->buf);
>   ... (deleted error-handling)
>   SLEEP(IO_Q,WAKEMAGIC);
>   if(!interrupt_done)
>     if(PGETPID())
>       DEBUG(("devscsi read: Interrupt is not done, why aren\'t we sleeping ?"));
>   while(!interrupt_done) NAP(50);       /* This sometimes happens. Why ??? */
>   cmd->status=status;           /* See comment at the end of writing_command */
>   return 0l;
> }
> 
> long  our_RWABS_vector(int rwflag, void *buf, int cnt,
>                        int recno, int dev, long lrecno ) {
>   if (!interrupt_done)
>      SLEEP(IO_Q, WAKEMAGIC);
>   return (Bios_RWABS(rwflag, buf, cnt, recno, dev, lrecno));
> }

The low-level driver does in it's interrupt process a
>  ipl=ipl(interrupted_process);
>  interruptroutine(get_acsiresult());
>  rte
>

So, here comes the real problem:

i change to a minix-fs partition and start
	cpio --block_size=128 -tvI /dev/tape >tape.lst &

Everything works fine until i try to execute a command from
a TOS-Filesystem (for example, ls.ttp).
I then get a "stack_underflow", which came from do_wakeup_things.
The background seems to be the "rwabs" from TOS itself, which is
called from a system-stack (and thats much below the user-stack)
and is captured in "our_RWABS_vector".

How can I get around this problem?

--
=========================================================================
rfc822: orschied@zxd.basf-ag.de				Juergen Orschiedt
X.400:	G=juergen; S=orschiedt; OU1=zxd;	  BASF Aktiengesellschaft
	P=basf-ag; A=dpb; C=de		 		 ZXD/BA - HC 1615
Phone:	(0621) 60-41468				     D-67056 Ludwigshafen
=========================================================================