Mail Archives: djgpp/1994/01/17/09:29:12

Date: Mon, 17 Jan 94 09:08:07 -0500
From: DJ Delorie <dj AT ctron DOT com>
To: ptan AT compudyn DOT com
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Multitasking under djgpp

> 1.  I need to be able to hook into the timer, serial, and some other
> interrupts.  What is the best way to do this?  Should I hook into the
> DPMI functions or should I try to reprogram the IDT myself to point
> to my own interrupt handler (I want to have the interrupt handler
> reside in 32 bit protected mode for speed reasons).

You must use the DPMI functions.

> 2. I need to be able to use the timer ticks to call the scheduler to
> switch tasks.  I've heard that DPMI does not allow interrupt tasks
> to interact with other tasks... specifically, that if the interrupt
> task is called, it must IRET, and cannot just ACK the 8259 and jump
> to the scheduler.  Right now, my kernel just ACKs the interrupt from
> the 8259, pops the registers into my own context save area and then
> executes the interrupt handler and then runs the scheduler again.

This is correct, as the interrupt may not occur from your task, and
always happens on a specially allocated stack segment.

> Now, bear with me, I'm new to the 32-bit IDT/GDT/LDT/TSS lingo, but
> as far as I understand it, I have cannot do this under DPMI.  Is
> this true?  Do I have to hack in something into go32 to allow the
> interrupt handler to change the IP of the TSS that was interrupted
> to point to the scheduler?  Otherwise, I can't seem to see a way to do
> pre-emptive multitasking, or am I missing something obvious?

In DPMI mode, go32 is NOT in charge of interrupts.  You must comply
with the DPMI spec, which details the layout of the interrupt stack
and how to fiddle with it.

> 3. I've written my own low-level (direct to hardware) disk access
> routines that understands FAT file systems (and is re-entrant).
> Can I tell the paging routines to use that instead?
> (sorry, I got lost somewhere in the middle of deciphering the
> go32 source, so if it is obvious just yell).

Not really, since those routines might get paged out and then what do
you call to get them back into memory?

> 4. I've heard that there is a problem locking down the pages for the
> interrupt handlers right now.  Is there a workaround?  Can I just
> disable paging for now?  If so, how?

No problem; I just forgot to tell people to do it.  It's only needed
in DPMI mode, as go32 can handle paging in interrupt handlers.  Just
do the appropriate DPMI call to lock them.

- Raw text -

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