Porting pice. Bug fixes.

svn path=/trunk/; revision=2576
This commit is contained in:
Eugene Ingerman 2002-01-29 04:21:17 +00:00
parent ae77777da5
commit e8e9853e27
4 changed files with 59 additions and 17 deletions

View file

@ -98,7 +98,6 @@ BOOLEAN PiceKbdIsr (
else if(bControl==TRUE && ucKey==AsciiToScan(ucBreakKey)) // CTRL-D
{
// fake a CTRL-D release call
bForward=FALSE;
bEnterNow=TRUE;
bControl=FALSE;
// simulate an initial break
@ -109,7 +108,8 @@ BOOLEAN PiceKbdIsr (
pushl $" STR(REASON_CTRLF) "
jmp NewInt31Handler
returnpoint:");
*pByte = 0x1d | 0x80 | 0x7f;
bForward=TRUE;
}
else if((ucKey == 66|| ucKey == 68) && bStepping)
{

View file

@ -182,15 +182,16 @@ ULONG HandlePageFault(FRAME* ptr)
// current process
tsk = IoGetCurrentProcess();
if( !tsk || !(IsAddressValid((ULONG)tsk))){
DPRINT((0,"tsk address not valid: tsk: %x\n", tsk));
DPRINT((2,"tsk address not valid: tsk: %x\n", tsk));
return 0;
}
// lookup VMA for this address
if( address > KERNEL_BASE )
vma = my_init_mm; // use kernel mem area for kernel addresses
if( (ULONG)address > KERNEL_BASE )
vma = my_init_mm; // use kernel mem area for kernel addresses
else vma = &(tsk->AddressSpace); // otherwise, use user memory area
if( !vma || !(IsAddressValid((ULONG)vma))){
if( !vma ){
DPRINT((0,"vma not valid: vma: %x\n", vma));
return 0;
}
@ -205,6 +206,7 @@ ULONG HandlePageFault(FRAME* ptr)
current = CONTAINING_RECORD(current_entry,
MEMORY_AREA,
Entry);
DPRINT((0,"address: %x %x - %x Attrib: %x, Type: %x\n", address, current->BaseAddress, current->BaseAddress + current->Length, current->Attributes, current->Type));
if( (address >= current->BaseAddress) && (address <= current->BaseAddress + current->Length ))
@ -218,13 +220,13 @@ ULONG HandlePageFault(FRAME* ptr)
current->Type == MEMORY_AREA_PAGED_POOL ||
current->Type == MEMORY_AREA_SHARED_DATA
){
//Print(OUTPUT_WINDOW,"pICE: VMA Pageable Section.\n");
DPRINT((2,"return 0 1\n"));
Print(OUTPUT_WINDOW,"pICE: VMA Pageable Section.\n");
//ei DPRINT((2,"return 0 1\n"));
return 0; //let the system handle this
}
Print(OUTPUT_WINDOW,"pICE: VMA Page not present in non-pageable Section!\n");
DPRINT((2,"Type: currenttype: %x return 1 2\n", current->Type));
return 1;
//ei DPRINT((2,"Type: currenttype: %x return 1 2\n", current->Type));
return 0;
}
else{ //access violation
@ -233,10 +235,10 @@ ULONG HandlePageFault(FRAME* ptr)
if( (ULONG)address >= KERNEL_BASE )
{
Print(OUTPUT_WINDOW,"pICE: User mode program trying to access kernel memory!\n");
DPRINT((2,"return 1 3\n"));
//DPRINT((2,"return 0 3\n"));
return 1;
}
DPRINT((2,"return 0 4\n"));
//DPRINT((2,"return 0 4\n"));
return 0;
}
/*

View file

@ -979,21 +979,23 @@ ULONG FindFunctionInModuleByName(LPSTR szFunctionname, PDEBUG_MODULE pd)
LPSTR pName;
PIMAGE_SECTION_HEADER pShdrThis = (PIMAGE_SECTION_HEADER)pShdr + (pSym->SectionNumber-1);
DPRINT((0,"FindFunctionInModuleByName(): %s @ %x\n",pName,start));
start = ((ULONG)pd->BaseAddress+pShdrThis->VirtualAddress+pSym->Value);
DPRINT((0,"FindFunctionInModuleByName(): %s @ %x\n",szFunctionname,start));
if(pSym->N.Name.Short){ //if name is stored in the structure
//name may be not zero terminated but 8 characters max
if((PICE_strncmpi(pName,szFunctionname, 8) == 0) && start)
pName = pSym->N.ShortName; //name is in the header
if((PICE_fnncmp(pName,szFunctionname, 8) == 0) && start)
{
DPRINT((0,"FindFunctionInModuleByName(): symbol was in symbol table\n"));
DPRINT((0,"FindFunctionInModuleByName(): symbol was in symbol table, start: %x\n", start));
LEAVE_FUNC();
return start;
}
}else{
if((PICE_strcmpi(pName,szFunctionname) == 0) && start)
pName = pStr+pSym->N.Name.Long;
if((PICE_fncmp(pName,szFunctionname) == 0) && start)
{
DPRINT((0,"FindFunctionInModuleByName(): symbol was in string table\n"));
DPRINT((0,"FindFunctionInModuleByName(): symbol was in string table, start: %x\n", start));
LEAVE_FUNC();
return start;
}

View file

@ -358,6 +358,44 @@ ULONG PICE_fncmp(char* s1,char* s2)
return result;
}
//*************************************************************************
// PICE_fnncmp()
//
// compare function names ignoring decorations:
// leading '_' or '@" and trailing "@xx" . Decorations are included in total length.
//*************************************************************************
ULONG PICE_fnncmp(char* s1,char* s2, ULONG len)
{
ULONG result=1;
ULONG len1 = len, len2 = len;
if( IsAddressValid((ULONG)s1) && (*s1 == '_' || *s1 == '@')){
s1++;
len1--;
}
if( IsAddressValid((ULONG)s2) && (*s2 == '_' || *s2 == '@')){
s2++;
len2--;
}
while(len1 && len2 && IsAddressValid((ULONG)s1) && *s1 && // not end of string
IsAddressValid((ULONG)s2) && *s2 )
{
if( (*s1 != *s2) || *s1=='@' || *s2=='@' )
break;
s1++;
s2++;
len1--;
len2--;
}
// strings same length
if((len1==0 || *s1=='@') && (len2==0 || *s2 =='@')){
result=0;
}
return result;
}
ULONG PICE_wcsicmp(WCHAR* s1, WCHAR* s2)
{
ULONG result=1;