delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/06/09:49:52

From: Olivier PERRON <olivier DOT perron AT art DOT alcatel DOT fr>
Newsgroups: comp.os.msdos.djgpp
Subject: Problem with interrupt handling
Date: Mon, 06 Oct 1997 13:21:18 +0200
Organization: Alcatel/Bell
Lines: 67
Message-ID: <3438C9AE.2BBD@art.alcatel.fr>
NNTP-Posting-Host: rtbsci143s.art.alcatel.fr
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi,

I'm trying to work with interrupt and interrupt handler. My problem is
that the following sample program doesn't work. Under a Windows 95 dos
box, I have a "non conform operation" error message.
What am I doing wrong ?


#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <string.h>
#include <values.h>
#include <go32.h>
#include <dpmi.h>
 
_go32_dpmi_seginfo _v0xF1;
 
int my_exit(void);
 
void my_handler(void)
{
  printf("I'm in my_handler\n");
}
 
 
void main(void)
{
 
    _go32_dpmi_seginfo info;
    __dpmi_regs r;
    char rep[10];
 
 
    /* save current 0xF1 int context */
    _go32_dpmi_get_protected_mode_interrupt_vector( 0xF1, &_v0xF1 );
 
    memset(&info, 0, sizeof(_go32_dpmi_seginfo));
    info.pm_selector = _go32_my_cs();
    info.pm_offset   = (unsigned long )my_handler;
    _go32_dpmi_allocate_iret_wrapper(&info);
    _go32_dpmi_set_protected_mode_interrupt_vector(0xF1, &info);

    /*
    big_loop();
    */
    printf("Press <ENTER> to continue: ");
    scanf("%c", rep);
 
    printf("Generating 0xF1 interrupt\n");
 
    memset(&r, 0, sizeof(__dpmi_regs));
    __dpmi_int(0xF1, &r);
 
    printf("Returning from 0xF1 interrupt\n");
 
    my_exit();
 
}
 
int my_exit(void)
{
    /* restore previous context */
    _go32_dpmi_set_protected_mode_interrupt_vector(0xF1, &_v0xF1);
 
    exit(0);
}

- Raw text -


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