Porting pice. Workaround for a bug in gcc. Some other small stuff.

svn path=/trunk/; revision=2578
This commit is contained in:
Eugene Ingerman 2002-01-30 19:45:24 +00:00
parent 87b5401bff
commit 23b672891b
2 changed files with 30 additions and 20 deletions

View 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));

View 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)