Path: utzoo!utgpu!watmath!clyde!att!pacbell!ames!amdahl!uunet!mcvax!ukc!stc!axion!agray
From: agray@zaphod.axion.bt.co.uk (Andy Gray)
Newsgroups: comp.os.minix
Subject: Re: MINIX/ST  MDI and KBD Blues
Message-ID: <706@zaphod.axion.bt.co.uk>
Date: 2 Dec 88 09:35:45 GMT
References: <284@lzaz.ATT.COM>
Sender: news@axion.bt.co.uk
Reply-To: agray@zaphod.axion.bt.co.uk
Lines: 55

From article <284@lzaz.ATT.COM>, by hcj@lzaz.ATT.COM (HC Johnson):
> 2. Most attempts to read in MIDI interrupts lock up the system.

Hmm I have noticed that in the vanilla distribution there is a bit of puzzling
code. (I will be checking this through later, but here I am just stating an
observation)

In stmain.c (aciaint)

	if (MDI->ac_cs & A_IRQ)
		mdiiint();

	...

mdiint(t)	{fake_int("mdiint",t);}

	...

fake_int(s, t) char *s; {
  printf("Fake interrupt handler for %s. trap = %02x\n", s, t);

	Studying async reveals

	move.w	d0,(sp)		! push trap type as argument
	jsr	(a0)		! call service routine
	tst.w	(sp)+		! pop trap type

	This is a bit opportunist isn't it? Are we sure that we are getting
the trap type as our argument 't' and not some miscellaneous stored 'pc'
value. I am not highly experienced in analyzing 68k assembler yet, and my data
book is not handy, but the stack state seems to be

	trap type
	address of 'tst.w (sp)+'
	address of code following 'mdiint()' in 'aciaint'

	then we call 'fake_int' pushing a pointer to a static string (OK) and
't' by value. Is the value of 't' 

	1.	the address of the 'tst.w (sp)+' instruction
	2.	the trap type

	If anyone has any answers to this can they post (or E_Mail me) as I am
somewhat puzzled by this, and I am also writing service routines in this area.

	Andy Gray

----------------------------------------------------------------------------
E-Mail (UUCP)   AGray@axion.bt.co.uk ...!ukc!axion!AGray
Organisation	UNIX Operating System Support and Development Group
		British Telecom Research Laboratories (RT3134)
Snail Mail	BTRL, Rm G23 B68, Martlesham Heath, IPSWICH IP5 7RE, UK
Telephone	+44 473 646647
Quote		"Hey - somebody's crept in here and committed a neatness!"
----------------------------------------------------------------------------