delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/11/10/09:39:59

Date: Wed, 10 Nov 93 09:23:01 -0500
From: DJ Delorie <dj AT ctron DOT com>
To: cnc AT netcom DOT com
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: how to install a PM keyboard handler/C calling conventions

> I'd like to install my own keyboard handler that talks directly to
> the keyboard hardware and the PIC in protected mode without chaining
> to the standard keyboard handler (I want to keep an array of flags for
> the state of each key, and the array should be in protected memory so
> my program can access it).  Do I have to modify go32 to accomplish
> this, or can I just locate the IDT in memory and stick the address
> of my handler in the 9th slot?  For that matter, how do I locate the
> IDT, and can I change it without causing a fault?

When 1.11 comes out, this will be easier.  Note that you'll have to
trap both the protected mode handler *and* the real mode handler.  You
can't rely on the IDT being available, as DPMI doesn't allow you to
change it.

> What are the register-conventions for a djgpp C-callable assembly
> routine?  Do all of the registers (EAX, EBX, ECX, EDX, ESI, EDI)
> need to be saved, or just ESI and EDI?  From looking at the assembly
> output of gcc, I'm assuming than the return values are returned in EAX.
> Where would this kind of documentation be found?

ebx, esi, ebp, and edi must be preserved.  Return values are in eax
unless they're 64 bits, then in edx:eax.  Floating point values are
passed on the stack and returned in st(0).  Most of this information
is stored in the bowels of gcc's source code.


- Raw text -


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