delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/01/13/06:41:55

Date: Mon, 13 Jan 1997 12:15:38 +0100 (MET)
From: Robert Hoehne <robert DOT hoehne AT mathematik DOT tu-chemnitz DOT de>
To: DJGPP workers <djgpp-workers AT delorie DOT com>
Subject: Not a final patch for dbgcom.c
Message-Id: <Pine.HPP.3.95.970113120854.27972A-100000@newton.mathematik.tu-chemnitz.de>
Mime-Version: 1.0

Since I know, that the ALLEGRO library is very popular,
I tried also a little bit with the samples from that
lib and tried to debug it.

During this I tested a little patch for dbgcom.c, which allows
that the debuggee can hook the keyboard and the time interrupt
by saving and restoring these two interrupts when running
the debugge. Because I don't know, if there will be some
problems, which I can't imagine now, the patch below is
only for testing if it works.

I want to get any suggestion if it will be work or not or
if there are also some other interrupts, which should be
saved/restored.

If the patch works for you (or if you think that it will
be work without problems) I will resend the patch again
in the next time.

Robert

*** dbgcom.c~	Fri Jan 10 14:21:34 1997
--- dbgcom.c	Fri Jan 10 12:09:18 1997
*************** void _clear_break_DPMI(void)
*** 144,149 ****
--- 144,151 ----
  }
  
  static __dpmi_paddr old_i31,old_i21;
+ static int user_int_set = 0;
+ static __dpmi_paddr my_i9,user_i9,my_i8,user_i8;
  
  static void hook_dpmi(void)
  {
*************** static void hook_dpmi(void)
*** 152,163 ****
--- 154,172 ----
  
    __dpmi_get_protected_mode_interrupt_vector(0x21, &old_i21);
    __dpmi_get_protected_mode_interrupt_vector(0x31, &old_i31);
+   __dpmi_get_protected_mode_interrupt_vector(0x09, &my_i9);
+   __dpmi_get_protected_mode_interrupt_vector(0x08, &my_i8);
  
    asm("mov %%cs,%0" : "=g" (new_int.selector) );
    new_int.offset32 = (unsigned long)i21_hook;
    __dpmi_set_protected_mode_interrupt_vector(0x21, &new_int);
    new_int.offset32 = (unsigned long)i31_hook;
    __dpmi_set_protected_mode_interrupt_vector(0x31, &new_int);
+   if (user_int_set)
+   {
+     __dpmi_set_protected_mode_interrupt_vector(0x09, &user_i9);
+     __dpmi_set_protected_mode_interrupt_vector(0x08, &user_i8);
+   }
  }
  
  /* Change a handle in the list: EAX is the old handle, EDX is the new */
*************** Lc31b:	.byte	0x2e							\n\
*** 349,357 ****
  	pushl	(%eax)							\n\
  	pushl	%eax							\n\
  	call	_longjmp						\n\
! Lc31d:	cmpb	$9,%bl							\n\
! 	je	Lc31a							\n\
! 	cmpb	$0x75,%bl						\n\
  	je	Lc31a							\n\
  	jmp	Lc31c							\n\
  Lc31_alloc_mem:								\n\
--- 358,364 ----
  	pushl	(%eax)							\n\
  	pushl	%eax							\n\
  	call	_longjmp						\n\
! Lc31d:	cmpb	$0x75,%bl						\n\
  	je	Lc31a							\n\
  	jmp	Lc31c							\n\
  Lc31_alloc_mem:								\n\
*************** static void unhook_dpmi(void)
*** 489,494 ****
--- 496,506 ----
  {
    __dpmi_set_protected_mode_interrupt_vector(0x31, &old_i31);
    __dpmi_set_protected_mode_interrupt_vector(0x21, &old_i21);
+   __dpmi_get_protected_mode_interrupt_vector(0x09, &user_i9);
+   __dpmi_get_protected_mode_interrupt_vector(0x08, &user_i8);
+   user_int_set = 1;
+   __dpmi_set_protected_mode_interrupt_vector(0x09, &my_i9);
+   __dpmi_set_protected_mode_interrupt_vector(0x08, &my_i8);
  }
  
  static void dbgsig(int sig)
*************** static void close_handles(void); /* Forw
*** 630,635 ****
--- 642,650 ----
  void cleanup_client(void)
  {
    int i;
+ 
+   /* Do not use the user int9 handler, it may be invalid */
+   user_int_set = 0;
    /* Close all handles, which may be left open */
    close_handles();
    for (i=0;i<DOS_DESCRIPTOR_COUNT;i++)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019