www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/23/08:51:02

From: DavMac AT iname DOT com (Davin McCall)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: newbie interrupt programmer
Date: Sun, 23 May 1999 12:17:49 GMT
Organization: Monash Uni
Lines: 58
Distribution: world
Message-ID: <3747f048.4200727@newsserver.cc.monash.edu.au>
References: <Pine DOT GSO DOT 3 DOT 96 DOT 990520155027 DOT 16539A-100000 AT gold DOT cs DOT umanitoba DOT ca> <3744ab46 DOT 8419473 AT newsserver DOT cc DOT monash DOT edu DOT au> <Pine DOT SUN DOT 3 DOT 96 DOT 990521115732 DOT 9402A-100000 AT silver DOT cs DOT umanitoba DOT ca>
NNTP-Posting-Host: damcc5.halls.monash.edu.au
X-Trace: towncrier.cc.monash.edu.au 927461840 27702 130.194.198.138 (23 May 1999 12:17:20 GMT)
X-Complaints-To: abuse AT monash DOT edu DOT au
NNTP-Posting-Date: 23 May 1999 12:17:20 GMT
X-Newsreader: Forte Free Agent 1.1/32.230
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

There is one other problem I didn't have too much trouble spotting.
(you really *are* new to this, aren't you...)

You can't just create a function and set it up as an interrupt
handler. This is because normal functions
a) don't save register values and
b) don't return using 'iret'

You need to create a wrapper function, using:

_go32_dpmi_allocate_iret_wrapper()

Also, how are you locking the code/data? If you must code the handler
in C (instead of assembly, which is preferable), the only really
guarenteed way of locking functions is to lock *all* code.

I stress that you should obtain a copy of FAQ and read carefully and
completely the related sections.

Davin.


On Fri, 21 May 1999 12:26:04 -0500, Mark Phillips
<umphill5 AT cs DOT umanitoba DOT ca> wrote:

>
>hmm, well i guess my interrupt wasn't getting called. 
>i realised my irq settings were wrong and i changed 
>those.  now, the sound will play, and when it's done,
>i get a SIGSEGV GPF.  i assume the interrupt function
>is getting called now and something in it is doing 
>bad things.  here is the function again:
>
>static void interrupt_handler()
>{
>   inportb(interptAcknowlg8);	// sb acknowledge
>   donePlaying = true;
>   outportb(0x20,0x20);		// acknowledge interrupt
>   outportb(0xA0,0x20);
>}
>
>it looks ok to me.  i'm pretty sure i locked 
>down all of the relevant code/variables. i just
>locked interptAcknowlg8, donePlaying, and then 
>the function code itself.  do i have to lock 
>inportb and outportb and anything they call
>too? i looked at the faq, and the only thing i 
>could find that might be helpful was "do all 
>the other chores described in the DPMI spec" 
>which i don't think i did, but when i looked at 
>the spec i couldn't really see where it said 
>what i was supposed to do. the message when it 
>crashes is this:
>
[snip]
__________________________________________________________
       *** davmac - sharkin'!! davmac AT iname DOT com ***
my programming page: http://yoyo.cc.monash.edu.au/~davmac/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019