Mail Archives: djgpp-workers/2002/07/21/12:36:25
> > Try the program I provided in email dated 19 May 2002 15:36 - small and
> > easy to debug. The upstroke keyboard interrupt is very easy to cause an
> > interrupt in the sbrk and cause a crash.
>
> It seems to crash in the same way with and without the cli fix. I tried:
>
> <program name> 100 500 1000 10000 100
>
> and it crashed every time after five key presses irrespective of how fast I
> press the keys.
If the cli fix doesn't work then that means good old NT 4 doesn't even
virtualize the cli, it just ignores it ...
Does this version crash? It disables the keyboard hooking. This might
be a long term fix. But in the meantime, it seems that unixy sbrk under
NT 4.0 is just badly broken, thanks to MS bugz
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <crt0.h>
#include <sys/nearptr.h>
#include <dpmi.h>
int _crt0_startup_flags = _CRT0_FLAG_UNIX_SBRK;
int main(int argc, char** argv) {
int i,j;
__djgpp_exception_toggle();
printf("My starting base address is 0x%8.8x, istate=%d\n",
__djgpp_base_address,__dpmi_get_virtual_interrupt_state());
for(i=1;i<argc;i++) {
j = 1024*atoi(argv[i]);
if(j > 0) {
printf("sbrk(%d)...(press a key)\n",j);
getkey();
j = (int)sbrk(j);
printf("returned 0x%8.8x, new base is 0x%8.8x, istate=%d\n",j,
__djgpp_base_address,__dpmi_get_virtual_interrupt_state());
}
}
return 0;
}
Thanks for looking at this
- Raw text -