Porting pice. Workaround for a bug in gcc. Some other small stuff.
authorEugene Ingerman <geneing@myrealbox.com>
Wed, 30 Jan 2002 19:45:24 +0000 (19:45 +0000)
committerEugene Ingerman <geneing@myrealbox.com>
Wed, 30 Jan 2002 19:45:24 +0000 (19:45 +0000)
svn path=/trunk/; revision=2578

reactos/apps/utils/pice/module/trace.c
reactos/apps/utils/pice/module/utils.c

index 497bc50..1aaacfd 100644 (file)
@@ -39,23 +39,6 @@ void DeInstallTraceHook(void);
 
 volatile ULONG OldInt1Handler=0;
 
-__asm__("
-NewInt1Handler:
-        pushl %eax
-               movl %dr6,%eax
-               testl $(1<<14),%eax
-               jz exceptionnotsinglestep
-
-        popl %eax
-        pushl $" STR(REASON_SINGLESTEP) "
-        jmp NewInt31Handler
-
-exceptionnotsinglestep:
-        popl %eax
-        pushl $" STR(REASON_HARDWARE_BP) "
-        jmp NewInt31Handler
-");
-
 BOOLEAN InstallTraceHook(void)
 {
        ULONG LocalInt1Handler;
@@ -75,6 +58,26 @@ BOOLEAN InstallTraceHook(void)
        return TRUE;
 }
 
+//this asm function must be at least second in the file. otherwise gcc does not
+//generate correct code.
+__asm__("
+NewInt1Handler:
+       pushl %eax
+               movl %dr6,%eax
+               testl $(1<<14),%eax
+               jz exceptionnotsinglestep
+
+        popl %eax
+        pushl $" STR(REASON_SINGLESTEP) "
+               //call _ping1
+        jmp NewInt31Handler
+
+exceptionnotsinglestep:
+        popl %eax
+        pushl $" STR(REASON_HARDWARE_BP) "
+        jmp NewInt31Handler
+");
+
 void DeInstallTraceHook(void)
 {
        DPRINT((0,"DeInstallTraceHook(OldInt1Handler=%0.8x)...\n",OldInt1Handler));
index ab408fb..74d6f7b 100644 (file)
@@ -396,13 +396,20 @@ ULONG PICE_fnncmp(char* s1,char* s2, ULONG len)
        return result;
 }
 
+wchar_t PICE_towlower(wchar_t c)
+{
+   if ( c>=L'A' && c<=L'Z' )
+       return (c - (L'A' - L'a'));
+   return(c);
+}
+
 ULONG PICE_wcsicmp(WCHAR* s1, WCHAR* s2)
 {
     ULONG result=1;
 
     while(IsAddressValid((ULONG)s1) && *s1 && // not end of string
           IsAddressValid((ULONG)s2) && *s2 && // not end of string
-          towlower(*s1)==towlower(*s2) ) // char are the same except case
+          PICE_towlower(*s1)==PICE_towlower(*s2) ) // char are the same except case
     {
         s1++;
         s2++;
@@ -1976,9 +1983,9 @@ int PICE_sprintf(char * buf, const char *fmt, ...)
 UCHAR AsciiFromScan(UCHAR s)
 {
   ULONG i;
-  
+
   ENTER_FUNC();
-  
+
   if(!bShift)
     {
       if(ucKeyboardLayout == GERMANY)