delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2004/10/28/14:15:10

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
From: Andris Pavenis <pavenis AT latnet DOT lv>
To: djgpp-workers AT delorie DOT com
Subject: Re: gcc-3.4 and djgpp/src/debug/common/dbgcom.c
Date: Thu, 28 Oct 2004 21:19:28 +0300
User-Agent: KMail/1.7.1
References: <200410271928 DOT 05413 DOT pavenis AT latnet DOT lv> <200410271643 DOT i9RGhnNr032006 AT envy DOT delorie DOT com>
In-Reply-To: <200410271643.i9RGhnNr032006@envy.delorie.com>
MIME-Version: 1.0
Message-Id: <200410282119.28711.pavenis@latnet.lv>
Reply-To: djgpp-workers AT delorie DOT com

On Wednesday 27 October 2004 19:43, DJ Delorie wrote:
> Can we put it as an input operand of that big asm?  We don't have to
> use it, just add it.
>
> asm("
>    ...
>    " : "g" (forced_test));

Unfortunatelly it doesn't work. Both gcc-3.4.2 and gcc-4.0.0 20041014 rejects
extended inline assembler outside the procedures.

> Of course, it's starting to look like a big chunk of dbgcom.c should
> be moved to a separate assembler file.

Maybe.

So at this moment I suggest the following fix:
 renaming forced_test to __dj_forced_test
 and making it external

Andris

Index: djgpp/src/debug/common/dbgcom.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/debug/common/dbgcom.c,v
retrieving revision 1.25
diff -p -3 -r1.25 dbgcom.c
*** djgpp/src/debug/common/dbgcom.c 27 Oct 2004 15:47:23 -0000 1.25
--- djgpp/src/debug/common/dbgcom.c 28 Oct 2004 18:10:28 -0000
*************** static void hook_dpmi(void)
*** 340,346 ****
    __djgpp_app_DS = app_ds;
  }
  
! /* The instructions in forced_test[] MUST MATCH the expansion of:
  
     EXCEPTION_ENTRY($13)
     EXCEPTION_ENTRY($14)
--- 340,346 ----
    __djgpp_app_DS = app_ds;
  }
  
! /* The instructions in __dj_forced_test[] MUST MATCH the expansion of:
  
     EXCEPTION_ENTRY($13)
     EXCEPTION_ENTRY($14)
*************** static void hook_dpmi(void)
*** 362,368 ****
     the time.  So most DPMI servers don't support it, and our code will
     never be called if we tie it to exception 17.  In contrast, exception
     13 is GPF, and *any* DPMI server will support that!  */
! static unsigned char forced_test[] = {
    0x6a,0x0d,   /* pushl $0x0d */
    0xeb,0x10,   /* jmp relative +0x10 */
    0x6a,0x0e,   /* pushl $0x0e */
--- 362,368 ----
     the time.  So most DPMI servers don't support it, and our code will
     never be called if we tie it to exception 17.  In contrast, exception
     13 is GPF, and *any* DPMI server will support that!  */
! unsigned char __dj_forced_test[] = {
    0x6a,0x0d,   /* pushl $0x0d */
    0xeb,0x10,   /* jmp relative +0x10 */
    0x6a,0x0e,   /* pushl $0x0e */
*************** static unsigned char forced_test[] = {
*** 378,384 ****
    0x2e,0x80,0x3d  /* (beginning of) %cs:cmpb $0,forced */
  }; /* four next bytes contain the address of the `forced' variable */
  
! static int forced_test_size = sizeof (forced_test);
  
  static int forced_address_known = 0;
  static unsigned int forced_address = 0;
--- 378,384 ----
    0x2e,0x80,0x3d  /* (beginning of) %cs:cmpb $0,forced */
  }; /* four next bytes contain the address of the `forced' variable */
  
! static int forced_test_size = sizeof (__dj_forced_test);
  
  static int forced_address_known = 0;
  static unsigned int forced_address = 0;
*************** _change_exception_handler:              
*** 417,423 ****
          cld                                                             \n\
          movw  %cx,%es                                                   \n\
          movl  %edx,%edi                                                 \n\
!         movl  $_forced_test,%esi                                        \n\
          movl  _forced_test_size,%ecx                                    \n\
          repe                                                            \n\
          cmpsb                                                           \n\
--- 417,423 ----
          cld                                                             \n\
          movw  %cx,%es                                                   \n\
          movl  %edx,%edi                                                 \n\
!         movl  $___dj_forced_test,%esi                                   \n\
          movl  _forced_test_size,%ecx                                    \n\
          repe                                                            \n\
          cmpsb                                                           \n\
*************** void cleanup_client(void)
*** 1492,1498 ****
    /* Invalidate the info about the `forced' variable.  */
    forced_address_known = 0;
    forced_address = 0;
!   forced_test_size = sizeof (forced_test); /* pacify the compiler */
    /* Set the flag, that the user interrupt vectors are no longer valid */
    user_int_set = 0;
  
--- 1492,1498 ----
    /* Invalidate the info about the `forced' variable.  */
    forced_address_known = 0;
    forced_address = 0;
!   forced_test_size = sizeof (__dj_forced_test); /* pacify the compiler */
    /* Set the flag, that the user interrupt vectors are no longer valid */
    user_int_set = 0;
  

- Raw text -


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