extern dr_handle DWRVMAlloc( unsigned long len, int sect ) /********************************************************/ { alloc_struct *nChunk; if( len == 0 ) { return( 0 ); } nChunk = (alloc_struct *)DWRALLOC( len - 1 + sizeof( alloc_struct ) ); if( nChunk == NULL ) { DWREXCEPT( DREXCEP_OUT_OF_MMEM ); return( 0 ); } nChunk->next = AllocHead; AllocHead = nChunk; DWRSEEK( DWRCurrNode->file, sect, 0 ); DWRREAD( DWRCurrNode->file, sect, nChunk->data, len ); return( (dr_handle)nChunk->data ); }
static void ReadPage( page_entry * node, virt_struct vm ) /*******************************************************/ /* read a page in from the dwarf file */ { unsigned long size; drmem_hdl base; unsigned long offset; dr_section sect; sect = node->sect; size = DWRCurrNode->sections[sect].size; base = DWRCurrNode->sections[sect].base; offset = (vm.l - base) & ~((unsigned long)OFFSET_MASK); size -= offset; if( size > MAX_NODE_SIZE ) { size = MAX_NODE_SIZE; } node->mem = DWRALLOC( size ); node->inmem = true; ++PageCount; DWRSEEK( DWRCurrNode->file, sect, offset ); DWRREAD( DWRCurrNode->file, sect, node->mem, size ); }