www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/05/08/13:35:49

Date: Mon, 08 May 1995 11:32:00 -0400
To: djgpp AT sun DOT soe DOT clarkson DOT edu
From: gantose AT lerc DOT nasa DOT gov (Dave Gantose)
Subject: DJGPP hardware interrupt handler - beyond FAQ

I'm trying to do a serial port interrupt handler application in DJGPP. I
have read the FAQ about installing my DJGPP function as both a real mode and
a protected mode int handler using the _go32_dpmi_... functions. Now, I am
looking at the file serial.c that is part of the source for the Ladybug
debugger. It seems to show all the things I need to do, but it brings up
some questions:

In Ladybug, there are separate int handlers for real vs protected mode. The
C parts of the functions are identical, but the beginnings and ends are
different.
1) Specifically, both begin with asm("cli"), but then the pm driver also
pushes several registers and places the value of DS into location 0x107. Why?
2) At the end of the function, the real mode handler does
outportb(0x20,0x20), while the p-mode one does it in assembly. Does it matter?
3) The p-mode handler then pops all the stuff it pushed at the start. But I
notice that neither handler ever does a asm("sti"). Why not?
4) By the way, what's the difference between asm("cli")/asm("sti") and
disable()/enable()? Is one preferable over the other? Are there times when
you should not use one or the other?
5) To install a p-mode handler, the FAQ says to use
_go32_dpmi_allocate_iret_wrapper(), but Ladybug does not do this. Is it
because of the extra asm stuff at the start/end of the function?
6) In Ladybug, when the real mode int handler is installed, a real mode
handler for int 1C is also installed. That handler function, called
refresh_uart just resets the UART registers to the values they should have.
Is this necessary? Do those registers usually get stepped on somehow? Or
does it have to do with the debugger application itself (so I can ignore it)?
7) In Ladybug, before installing either the rm or pm handlers, a function
named write_child() is called. What does this do? Again, does it have to do
with the debugger itself, so that I can ignore it (I hope)?

Answers to any/all of these questions would be appreciated. I've been
fighting this application for some time now. I know it's been done a
thousand times out there, but I'm looking very bad because I can't seem to
make it 1001!


=============================================================================
Dave Gantose
ADF, Inc.
2001 Aerospace Pkwy.           phone: (216)977-1376
Brook Park, OH  44142          email: Gantose AT lerc DOT nasa DOT gov

- Raw text -


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