Mail Archives: djgpp/1994/09/06/15:03:48
I wrote a simple program to switch into dpmi protected mode...
(I need to understand how go32 works).
int dpmi_init(void)
{
unsigned hostdata_seg, hostdata_para, dpmi_flags;
REGS regs;
int flags;
regs.AX = 0x1687;
intr_2f(®s);
if(regs.AX != 0) {
printf("can't go into protected mode\n");
return;
}
printf("Bx = %x\n", regs.BX);
flags = regs.BX;
printf("Cl = %x\n", regs.CX & 0xff);
printf("DX = %x\n", regs.DX);
printf("Num paragraphs = %x\n", regs.SI);
printf("CS = %x, DS = %x\n", get_my_cs(), get_my_ds());
printf("dpmi pm interface at %x:%x\n", regs.ES, regs.DI);
hostdata_seg = malloc_dos_memory(regs.SI);
if(!hostdata_seg) {
printf("Cannot malloc dos memory\n");
exit();
}
flags &= ~1; /* clear 32 bit flag */
if(!dpmi_protected_mode(regs.DI, regs.ES, flags, hostdata_seg )) {
printf("No dpmi\n");
return;
}
#asm
mov ax,04c01h
int 21h
#endasm
; go into dpmi protect mode (entry point is passed in entry_point (offset, segme)
procdef dpmi_protected_mode,<<entry_point,dword>,<switch_flags, word>, <hostseg,word>>
mov ax,hostseg
mov es,ax
mov ax,switch_flags
call [entry_point]
jc no_dpmi
mov ax,1
; it works if I do an exit directly here
push 11h
extrn _dos_exit_:near
call _dos_exit_
pret
no_dpmi:
mov ax,0
pret
Everything appear to make sense -- however, the only think I can do
after I call the dpmi entry point which works is an int 21/0x4c...
(the status code is there).
1) I can't call another function (I tried to call _dos_exit and this is giving
me a protection fault
2) I can't return and do an exit (this gives me a protection fault...)
Help!!!
?????
marty
Member of the League of Programming Freedom
leisner AT sdsp DOT mc DOT xerox DOT com leisner AT eso DOT mc DOT xerox DOT com
- Raw text -