Mail Archives: djgpp-workers/1996/11/17/09:11:23
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,®s), 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(®s,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,®s);
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,®s);
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,®s);
printf("__dpmi_int (DOS again): %08lx\n",regs.d.eax);
return 0;
}
- Raw text -