www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/08/11:51:31

From: John Fine <johnfine AT erols DOT com>
Newsgroups: alt.os.development,alt.os.assembly,comp.lang.asm.x86,comp.os.msdos.djgpp,alt.lang.asm
Subject: Re: ISR with DJGPP in a kernel.
Date: 8 Jan 2000 15:17:11 GMT
Organization: Group Moderator
Lines: 31
Sender: news <news AT bob DOT news DOT rcn DOT net>
Approved: <johnfine AT erols DOT com>
Message-ID: <857kdn$6gf$1@bob.news.rcn.net>
References: <s7dr49t5oj886 AT corp DOT supernews DOT com>
Mime-Version: 1.0
X-Trace: s5dp6P+QjbeofN6K+U0gqqFwb+Xw/Uwknqn01ejiph0=
X-Complaints-To: abuse AT rcn DOT com
NNTP-Posting-Date: 8 Jan 2000 15:17:11 GMT
X-Accept-Language: en
X-Track2: 2
X-Mozilla-Status: 0801
X-Apparently-To: clax86 AT yahoo DOT com via web1704.mail.yahoo.com
X-Track: 1-1: 40
X-Mailer: Mozilla 4.51 [en]C-CCK-MCD {Typeline;BankBoston} (WinNT; U)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Groman wrote:

> Now I want to create a handler for 0(the timer) in C...
> now, how exactly do I do that... I mean it jumps out of the code right in
> the middle of the function...and starts another one?
> 
> that doesn't sound right...

  It is very tricky to write an ISR in DJGPP C.  It isn't worth the
trouble.

> shoud I do the handler in assembly that calls C functions then?

  Yes.  That is the best way.  Remember, before calling the C routine,
the assembler routine must save the registers that aren't saved by C
routines and must set DS and ES equal to SS (I'm assuming you can set up
the interrupt conditions so that SS will be correct on entry to the
interrupt.  That is almost automatic as long as the ISR is in ring 0 and
you have only one ring 0 stack segment per TSS).

> or is there a way to turn an ordinary DJGPP function
> into a handler...

  I'm fairly sure there isn't.  Some Borland C compilers support
keywords to declare a routine as an ISR;  Gnu C doesn't.  You could put
some inline ASM at the start and end of the C routine, but it is very
hard to coordinate with the entry and epilog code inserted by the
compiler.
-- 
http://www.erols.com/johnfine/
http://www.geocities.com/SiliconValley/Peaks/8600/

- Raw text -


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