Date: Mon, 8 Dec 1997 16:56:58 +0200 (IST) From: Eli Zaretskii To: djgpp-workers AT delorie DOT com cc: DJ Delorie , Charles Sandmann Subject: Enhanced signal support (1/2) Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk These changes add support for signal SIGQUIT. By default it is generated when Ctrl-\ is pressed and aborts the program with a traceback, like Ctrl-BREAK does. These changes also make the keys which generate SIGINT and SIGQUIT user-definable instead of being hard-coded. The intent is to provide the basis for termio-like ioctl functionality and termios enhancements. Right now, the only program I know that needs to change the SIGINT key is Emacs. This message includes changes to exceptn.S only; the rest is sent in a separate message. Since my assembly experience is virtually nonexistent, please examine this carefully in case I did something dangerous or inefficient. Please also review the questions related to design of these features that I send in yet another message. *** src/libc/go32/exceptn.S~0 Sun Dec 10 20:36:18 1995 --- src/libc/go32/exceptn.S Sat Dec 6 14:44:46 1997 *************** ___djgpp_app_DS: .word 0 *** 257,262 **** --- 257,270 ---- ___djgpp_dos_sel: .word 0 .global ___djgpp_hwint_flags ___djgpp_hwint_flags: .word 0 + .global ___djgpp_sigint_key + ___djgpp_sigint_key: .word 0 /* scan code and kb status */ + .global ___djgpp_sigint_mask + ___djgpp_sigint_mask: .word 0 /* kb status mask */ + .global ___djgpp_sigquit_key + ___djgpp_sigquit_key: .word 0 + .global ___djgpp_sigquit_mask + ___djgpp_sigquit_mask: .word 0 .global ___djgpp_old_kbd ___djgpp_old_kbd: .long 0,0 .global ___djgpp_old_timer *************** hw_to_excp: *** 287,315 **** .global ___djgpp_kbd_hdlr ___djgpp_kbd_hdlr: pushl %eax pushl %ds .byte 0x2e /* CS: */ testb $1, ___djgpp_hwint_flags /* Disable? */ jne Lkbd_chain - /* Check CTRL state */ movw %cs:___djgpp_dos_sel, %ds /* Conventional mem selector */ /* movw $0x7021,0xb0f00 */ /* Test code - write to mono */ ! testb $4,0x417 /* Test KB flags: CTRL down? */ ! je Lkbd_chain ! testb $8,0x417 /* Test KB flags: ALT down? */ ! jne Lkbd_chain /* Don't capture ALT-CTRL-C */ ! /* Check port for scan code */ ! inb $0x60,%al ! cmpb $0x2e,%al jne Lkbd_chain /* Clear interrupt, (later: remove byte from controller?) movb $0x20,%al outb %al,$0x020 */ 98: ! movb $0x79,%al call ___djgpp_hw_exception Lkbd_chain: popl %ds popl %eax ljmp %cs:___djgpp_old_kbd --- 295,335 ---- .global ___djgpp_kbd_hdlr ___djgpp_kbd_hdlr: pushl %eax + pushl %ebx pushl %ds .byte 0x2e /* CS: */ testb $1, ___djgpp_hwint_flags /* Disable? */ jne Lkbd_chain movw %cs:___djgpp_dos_sel, %ds /* Conventional mem selector */ /* movw $0x7021,0xb0f00 */ /* Test code - write to mono */ ! /* Check Keyboard status bits */ ! movb 0x417,%ah /* Get KB status byte */ ! testb $1,%ah ! je 6f ! orb $2,%ah /* If RShift is set, set LShift as well */ ! 6: ! inb $0x60,%al /* Read the scan code */ ! movb %ah,%bh /* Save KB status */ ! andb %cs:___djgpp_sigint_mask, %ah /* Mask off irrelevant bits */ ! cmpw %cs:___djgpp_sigint_key, %ax /* Test for SIGINT */ ! jne 7f ! movb $0x79,%bh /* SIGINT */ ! jmp 98f ! 7: ! movb %bh,%ah /* Restore KB status */ ! andb %cs:___djgpp_sigquit_mask, %ah /* Mask off irrelevant bits */ ! cmpw %cs:___djgpp_sigquit_key, %ax /* Test for SIGQUIT*/ jne Lkbd_chain + movb $0x7a,%bh /* SIGQUIT */ /* Clear interrupt, (later: remove byte from controller?) movb $0x20,%al outb %al,$0x020 */ 98: ! movb %bh,%al call ___djgpp_hw_exception Lkbd_chain: popl %ds + popl %ebx popl %eax ljmp %cs:___djgpp_old_kbd