www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/21/06:19:41

Xref: news2.mv.net comp.os.msdos.djgpp:4081
From: snarfy AT goodnet DOT com
Newsgroups: comp.os.msdos.djgpp
Subject: What does _go32_dpmi_chain_protected_mode_interrupt() really do?
Date: 21 May 1996 06:08:30 GMT
Organization: GoodNet
Lines: 47
Message-ID: <4nrmku$2sm@news1.goodnet.com>
NNTP-Posting-Host: goodnet.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I was wondering what _go32_dpmi_chain_protected_mode_interrupt() actually
does.  I'm trying to write a simple multitasking library that works
by allocating each process a stack, then inside the (timer) interrupt pushing
the regs onto the stack, switching to the next process's stack, then popping
them all off (except for flags, cs, and eip of course).


I'm going on the assumption that upon interrupt entry, eflags, cs, and eip
have been pushed onto the stack, and everything else is unchanged.  
Unfortunately it doesn't look like that is so.

here's a basic outline:

process_struct {
int *stack;
void (*proc)(void);
};

void spawn_proc(void (*proc)(void), int stack_size);
malloc a proc
malloc a new stack
set up the initial stack of this process; (cs, ss, esp, eip, etc...)

then I have 

void interrupt_handler(void)
{
   asm("push all regs, except cs, eip, & eflags (already there)
        switch stacks
        pop all regs except cs, eip, & eflags 
        (es, eip, & eflags will get popped of at the iret instruction)");
}

I think the main problem is, is that I'm using _go32_dpmi_chain...
to install the interrupt handler.  I have to call the old interrupt 
handler though, so I'm stuck, and I'm not sure if _go32_dpmi_chain...
leaves all the registers like I excpect them to be after it does
all of its nifty wrapper stuff.


Thanks again.


Josh
snarfy AT goodnet DOT com

- Raw text -


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