free function causes page-fault
Posted: Fri Nov 09, 2007 11:26 am
Hi,
I'm having a problem with a free() function (stolen from PDClib), which seems to be causing my OS to pagefault. Is it possible if anyone can point out to me what is going wrong? (the error occurs in the free function itself: I've checked!)
This is the code for the function (located at 0x80000eff):
Here's from the function that called it:
CPU dump:
Thanks for your help in advance,
OScoder
I'm having a problem with a free() function (stolen from PDClib), which seems to be causing my OS to pagefault. Is it possible if anyone can point out to me what is going wrong? (the error occurs in the free function itself: I've checked!)
This is the code for the function (located at 0x80000eff):
Code: Select all
void free( void * ptr )
{
ptr = (void *)( (char *)ptr - sizeof( struct _PDCLIB_memnode_t ) );
( (struct _PDCLIB_memnode_t *)ptr )->next = NULL;
if ( _PDCLIB_memlist.last != NULL )
{
_PDCLIB_memlist.last->next = ptr;
}
else
{
_PDCLIB_memlist.first = ptr;
}
_PDCLIB_memlist.last = ptr;
}
Code: Select all
parameters_pointer = malloc(temp_size);
memcpy(parameters_pointer, ¶meters, temp_size);
p_procedure = object_table[i].object_data.procedure.function;
p_procedure((void*) parameters_pointer);
free(parameters_pointer);
Code: Select all
00006932077i[CPU ] CS.d_b = 32 bit
00006932077i[CPU ] SS.d_b = 32 bit
00006932077i[CPU ] | EAX=fffffff8 EBX=80000000 ECX=00000007 EDX=000b829f
00006932077i[CPU ] | ESP=80306f27 EBP=80306f27 ESI=000263bc EDI=000263d7
00006932077i[CPU ] | IOPL=0 NV UP EI NG NZ AC PO CY
00006932077i[CPU ] | SEG selector base limit G D
00006932077i[CPU ] | SEG sltr(index|ti|rpl) base limit G D
00006932077i[CPU ] | DS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00006932077i[CPU ] | ES:0010( 0002| 0| 0) 00000000 000fffff 1 1
00006932077i[CPU ] | FS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00006932077i[CPU ] | GS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00006932077i[CPU ] | SS:0010( 0002| 0| 0) 00000000 000fffff 1 1
00006932077i[CPU ] | CS:0008( 0001| 0| 0) 00000000 000fffff 1 1
00006932077i[CPU ] | EIP=80000eff (80000eff)
00006932077i[CPU ] | CR0=0xe0000011 CR1=0x00000000 CR2=0xfffffffc
00006932077i[CPU ] | CR3=0x00110000 CR4=0x00000000
00006932077i[CPU ] >> c7
00006932077i[CPU ] >> 40
00006932077i[CPU ] >> 04
00006932077i[CPU ] >> 00
00006932077i[CPU ] >> 00
00006932077i[CPU ] >> 00
00006932077i[CPU ] >> 00
00006932077i[CPU ] >> : mov dword ptr ds:[eax+0x4], 0x0
OScoder