delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/11/17/09:11:23

Date: Sun, 17 Nov 1996 15:57:16 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Bill Currie <billc AT blackmagic DOT tait DOT co DOT nz>
Cc: Charles Sandmann <sandmann AT clio DOT rice DOT edu>, djgpp-workers AT delorie DOT com
Subject: Re: cwsdpmi - rm callbacks and pm sw ints
In-Reply-To: <328F3F27.4ADE@blackmagic.tait.co.nz>
Message-Id: <Pine.SUN.3.91.961117154821.13902A-100000@is>
Mime-Version: 1.0

On Sun, 17 Nov 1996, Bill Currie wrote:

> If I allocate a real mode callback and insert it in the dos int 21 chain
> (havn't tried for others), and do a __dpmi_int(0x21,&regs), everything
> works fine. BUT, if I us a software interrupt instead, the computer
> locks up  and requires a reset.

I modified the `main' a bit to not use `_farsetsel' (paranoia) and give me
a chance to look at the printed values before it crashes (source below)
and ran it with CWSDPMI, QDPMI and PMODE.  Results: 

	QDPMI:   works, prints and beeps as advertised.
	CWSDPMI: crashes when INT 21h is issued after the RMCB is 
		 installed.  It seems the crash is *after* the RMCB is 
		 called and chains, because I hear the beep.
	PMODE:   prints 0 instead of deadbeaf, crashes with SIGSEGV when
		 INT 21h is issued.  I attach the traceback below, in the 
		 hope that it says something useful.

-------------------- PMODE crash traceback ---------------------------
INT 21h (DOS): 00001406
__dpmi_int (DOS): 00001406
__dpmi_int (handler): 00000000
Exiting due to signal SIGSEGV
General Protection Fault at eip=00000c09, error=3044
eax=00003046 ebx=13e816a8 ecx=00000030 edx=00003046 esi=000172a4 edi=000016cf
ebp=00000bd2 esp=00000700 program=C:\USR\TAKE\TEMP3\I21TP.EXE
cs: sel=0010  base=00013e80  limit=0000ffff
ds: sel=0018  base=00017270  limit=0000ffff
es: sel=0030  base=00017720  limit=00002ee8
fs: sel=0000
gs: sel=0000
ss: sel=0278  invalid

---------------------- modified main function --------------------------
int main()
{
	__dpmi_raddr raddr;
	__dpmi_regs regs;

	_go32_dpmi_lock_code(handleInt21,(unsigned long)main-(unsigned long)handleInt21);
	_go32_dpmi_lock_data(&dpmi_regs,sizeof(dpmi_regs));

	memset(&regs,0,sizeof(regs));
	__dpmi_allocate_real_mode_callback(handleInt21,&dpmi_regs,&raddr);
	/* _farsetsel(_dos_ds); */
	oldInt21=_farpeekl(_dos_ds, 0x21*4);
	asm("int $0x21":"=a"(regs.d.eax):"0"(0x3000):"%ebx","%ecx");
	printf("INT 21h (DOS): %08lx\n",regs.d.eax);
        getch();
	regs.x.ax=0x3000;
	__dpmi_int(0x21,&regs);
	printf("__dpmi_int (DOS): %08lx\n",regs.d.eax);
	_farpokel(_dos_ds, 0x21*4, raddr.segment<<16|raddr.offset16);
        cputs ("Installed Int 21h handler\r\n");
        getch();
	regs.x.ax=0x3000;
	__dpmi_int(0x21,&regs);
	printf("__dpmi_int (handler): %08lx\n",regs.d.eax);
        getch();
	asm("int $0x21":"=a"(regs.d.eax):"0"(0x3000):"%ebx","%ecx");
	printf("INT 21h (handler): %08lx\n",regs.d.eax);
	_farpokel(_dos_ds, 0x21*4, oldInt21);
	asm("int $0x21":"=a"(regs.d.eax):"0"(0x3000):"%ebx","%ecx");
	printf("INT 21h (DOS again): %08lx\n",regs.d.eax);
        getch();
	regs.x.ax=0x3000;
	__dpmi_int(0x21,&regs);
	printf("__dpmi_int (DOS again): %08lx\n",regs.d.eax);
	return 0;
}

- Raw text -


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