delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/01/25/04:24:46

Xref: news2.mv.net comp.os.msdos.djgpp:585
From: Robert Hoehne <rho AT hrz DOT tu-chemnitz DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Maybe a bug cwsdpmi ???
Date: 24 Jan 1996 12:16:52 GMT
Organization: TU Chemnitz-Zwickau
Lines: 66
Message-ID: <4e57vk$jc2@pyrrhus-f.hrz.tu-chemnitz.de>
NNTP-Posting-Host: cache.hrz.tu-chemnitz.de
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I want to write an interrupt-procedure with DJGPP.

I tried it with the following program, but every time I run it,
there is a Page fault. I am using DJGPP V2Beta4 and CWSDPMI Beta9.

Where is the error.

Here is my example

------------------------------------------------------------------
/* filename: test.c */

#include <stdio.h>
#include <stdlib.h>
#include <dpmi.h>
#include <go32.h>

__dpmi_raddr oldint80,newint80;
__dpmi_regs regs;

void _new_int80(void)
{
}

void exit_func(void)
{
  __dpmi_set_real_mode_interrupt_vector(0x80,&oldint80);
}

main()
{
  int i;
  char c;
  
  _go32_dpmi_lock_code(_new_int80,
         (unsigned long)(exit_func) - (unsigned long)_new_int80);
  __dpmi_get_real_mode_interrupt_vector(0x80,&oldint80);
  __dpmi_allocate_real_mode_callback(_new_int80,&regs,&newint80);
  dosmemget(newint80.segment*16+newint80.offset16,2048,buffer);
  atexit(exit_func);
  __dpmi_set_real_mode_interrupt_vector(0x80,&newint80);
  __dpmi_int(0x80,&regs);
  exit_func();
  __dpmi_free_real_mode_callback(&newint80);
}

/*

compiled with:
--------------

gcc -o test test.c

this is the result after running this program:
----------------------------------------------

Page fault cr2=10060fe7 in RMCB at eip=fe7; flags=3002
eax=00000000 ebx=00002396 ecx=00000000 edx=00050e67 esi=0001944e edi=0000a230
ebp=0004a298 esp=0000347c cs=e7 ds=3b es=f7 fs=33 gs=ff ss=33 error=0004

*/

------------------------------------------------------------------------------

bye Robert

- Raw text -


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