Message-Id: Date: Thu, 08 Aug 1996 16:38:56 +1200 From: Bill Currie To: djgpp-workers AT delorie DOT com Subject: window sti/cli bug I *THINK* i may have figured out why doing a cli under windows makes all further interrupts masked when running under windows. I was thinking that maybe windows has a vmint disabled count rather than a flag, and there are insufficient sti's to counteract the cli's (including implicit ones via int's). I did a grep on iret in src/libc (with context) and not all the hardware ISR's do a sti before the iret (even though the dpmi spec says this should be done). Here is a list of all occurences of the iret instruction (including data for _go32...), to be looked over to determine which irets should have an sti before them. Sorry about the size, but I thought some lines of context would be helpfull. Bill ---------------------------------- debug/common/dbgcom.c-166- je Lc31b \n\ debug/common/dbgcom.c-167- cmpw $0x0205,%ax \n\ debug/common/dbgcom.c-168- je Lc31d \n\ debug/common/dbgcom.c-169-Lc31c: .byte 0x2e \n\ debug/common/dbgcom.c-170- ljmp _old_i31 \n\ debug/common/dbgcom.c:171:Lc31a: iret \n\ debug/common/dbgcom.c-172-Lc31b: .byte 0x2e \n\ debug/common/dbgcom.c-173- cmpw ___djgpp_app_DS,%bx \n\ debug/common/dbgcom.c-174- jne Lc31c \n\ debug/common/dbgcom.c-175- pushf \n\ debug/common/dbgcom.c-176- .byte 0x2e \n\ -- libc/ansi/setjmp/longjmp.s-78- popl ___djgpp_exception_state_ptr libc/ansi/setjmp/longjmp.s-79- popl %ds libc/ansi/setjmp/longjmp.s-80- popl %edi libc/ansi/setjmp/longjmp.s-81- popl %esi libc/ansi/setjmp/longjmp.s-82- libc/ansi/setjmp/longjmp.s:83: iret /* actually jump to new cs:eip loading flags */ -- npx handler libc/go32/exceptn.s-279- movb $0x75,%al libc/go32/exceptn.s-280-hw_to_excp: libc/go32/exceptn.s-281- call ___djgpp_hw_exception libc/go32/exceptn.s-282- popl %eax libc/go32/exceptn.s-283- sti libc/go32/exceptn.s:284: iret libc/go32/exceptn.s-285- libc/go32/exceptn.s-286- .align 4 libc/go32/exceptn.s-287- .global ___djgpp_kbd_hdlr libc/go32/exceptn.s-288-___djgpp_kbd_hdlr: libc/go32/exceptn.s-289- pushl %eax -- timer handler libc/go32/exceptn.s-354-2: libc/go32/exceptn.s-355- pushl %eax libc/go32/exceptn.s-356- movb $0x20,%al /* EOI the interrupt */ libc/go32/exceptn.s-357- outb %al,$0x020 libc/go32/exceptn.s-358- popl %eax libc/go32/exceptn.s:359: iret libc/go32/exceptn.s-360- libc/go32/exceptn.s-361- /* On entry ES is the DS alias selector */ libc/go32/exceptn.s-362- .align 4 libc/go32/exceptn.s-363- .global ___djgpp_cbrk_hdlr /* A RMCB handler for 0x1b */ libc/go32/exceptn.s-364-___djgpp_cbrk_hdlr: -- control break handler libc/go32/exceptn.s-373- .byte 0x2e /* CS: */ libc/go32/exceptn.s-374- testb $2, ___djgpp_hwint_flags /* Count, don't kill */ libc/go32/exceptn.s-375- jne 1f libc/go32/exceptn.s-376- libc/go32/exceptn.s-377- call ___djgpp_hw_exception libc/go32/exceptn.s:378: iret libc/go32/exceptn.s-379-1: libc/go32/exceptn.s-380- incl %es:___djgpp_cbrk_count libc/go32/exceptn.s:381: iret libc/go32/exceptn.s-382- crit err, general libc/go32/exceptn.s-383- .global ___djgpp_i24 /* Int 24 handler if needed */ libc/go32/exceptn.s:384: .global ___djgpp_iret /* Int 23 handler if needed */ libc/go32/exceptn.s-385-___djgpp_i24: libc/go32/exceptn.s-386- movb $3,%al libc/go32/exceptn.s:387:___djgpp_iret: libc/go32/exceptn.s:388: iret libc/go32/exceptn.s-389- libc/go32/exceptn.s-390-/* Code to stop execution ASAP, EAX destroyed. Make DS/ES/SS invalid. libc/go32/exceptn.s-391- Fake exception value is passed in AL and moved into the "forced" variable. libc/go32/exceptn.s-392- This is used to convert a HW interrupt into something we can transfer libc/go32/exceptn.s-393- control away from via longjmp or exit(), common with SIGINT, SIGFPE, or -- libc/go32/gopint.c-69-/* 4F */ 0x0f, 0xa1, /* pop fs */ libc/go32/gopint.c-70-/* 51 */ 0x07, /* pop es */ libc/go32/gopint.c-71-/* 52 */ 0x1f /* pop ds */ libc/go32/gopint.c-72-}; libc/go32/gopint.c-73- libc/go32/gopint.c:74:static unsigned char wrapper_intiret[] = { libc/go32/gopint.c:75:/* 53 */ 0xcf, /* iret */ libc/go32/gopint.c-76-}; libc/go32/gopint.c-77- libc/go32/gopint.c-78-static unsigned char wrapper_intchain[] = { libc/go32/gopint.c-79-/* 53 */ 0x2e, 0xff, 0x2d, /* jmp cs: */ libc/go32/gopint.c-80-/* 56 */ FILL, FILL, FILL, FILL, /* [_old_int+39] */ libc/go32/gopint.c:81:/* 5A */ 0xcf, /* iret */ libc/go32/gopint.c-82-/* 5B */ FILL, FILL, FILL, FILL, /* old_address */ libc/go32/gopint.c-83-/* 5F */ FILL, FILL, /* old_segment */ libc/go32/gopint.c-84-}; libc/go32/gopint.c-85- libc/go32/gopint.c-86-unsigned long _go32_interrupt_stack_size = 32256; -- libc/go32/gormcb.c-66-/* 50 */ 0x26, 0x89, 0x47, 0x2a, /* mov es:[edi+42],eax */ libc/go32/gormcb.c-67-}; libc/go32/gormcb.c-68- libc/go32/gormcb.c-69-static unsigned char wrapper_retf[] = { libc/go32/gormcb.c-70- 0x66, 0x26, 0x83, 0x47, 0x2e, 0x04, /* add es:[edi+46],0x4 */ libc/go32/gormcb.c:71: 0xcf /* iret */ libc/go32/gormcb.c-72-}; libc/go32/gormcb.c-73- libc/go32/gormcb.c:74:static unsigned char wrapper_iret[] = { libc/go32/gormcb.c-75- 0x66, 0x8b, 0x46, 0x04, /* mov ax,[esi+4] */ libc/go32/gormcb.c-76- 0x66, 0x26, 0x89, 0x47, 0x20, /* mov es:[edi+32],ax */ libc/go32/gormcb.c-77- 0x66, 0x26, 0x83, 0x47, 0x2e, 0x06, /* add es:[edi+46],0x6 */ libc/go32/gormcb.c:78: 0xcf /* iret */ libc/go32/gormcb.c-79-}; libc/go32/gormcb.c-80- libc/go32/gormcb.c-81-unsigned long _go32_rmcb_stack_size = 32256; libc/go32/gormcb.c-82- libc/go32/gormcb.c-83-static int setup_rmcb(unsigned char *wrapper, _go32_dpmi_seginfo *info,