tmpLen = Buffer->Length;
SHORTREL( &Buffer->Lock );
- bufEnd = (Buffer->Start + Buffer->Length) % Buffer->Space;
+ bufEnd = (tmpStart + Buffer->Length) % Buffer->Space;
endSpace = Buffer->Space - bufEnd;
// Force to bounds
if(base & 63) {
Uint64 val = -1LL << (base & 63);
gaSuperBitmap[base / 64] &= ~val;
- size -= (base & 63);
- base += 64 - (base & 63);
+// size -= (base & 63);
+// base += 64 - (base & 63);
}
}
{
// Oops. ok, let's do an expensive check (scan down the list
// until a free range is found)
- nFree = 1;
- addr = giPhysRangeLast[ rangeID ];
- // TODO
+// nFree = 1;
+// addr = giPhysRangeLast[ rangeID ];
+ // TODO: Expensive Check
Mutex_Release(&glPhysicalPages);
// TODO: Page out
// ATM. Just Warning
#if USE_MP
}
for(pos=0;pos<giNumCPUs;pos++) {
- #endif
__asm__ __volatile__ ("ltr %%ax"::"a"(0x38+pos*16));
- #if USE_MP
}
+ #else
+ __asm__ __volatile__ ("ltr %%ax"::"a"(0x38));
#endif
// Set Debug registers
thread = gaCPUs[CPU].IdleThread;
//Warning("Hmm... Threads_GetNextToRun returned NULL, I don't think this should happen.\n");
//LogF("Zzzzz.\n");
- return;
+ //return;
}
#if DEBUG_TRACE_SWITCH
}\r
}\r
\r
+ if( !dynsymtab && iSymCount > 0 ) {\r
+ Log_Warning("ELF", "Elf_Relocate: No Dynamic symbol table, but count >0");\r
+ return 0;\r
+ }\r
\r
// Alter Symbols to true base\r
for(i = 0; i < iSymCount; i ++)\r
for( i = 0; i < j; i++ )\r
{\r
ptr = (void*)(iBaseDiff + rela[i].r_offset);\r
- if( !Elf_Int_DoRelocate(rel[i].r_info, ptr, rela[i].r_addend, dynsymtab, (Uint)Base) ) {\r
+ if( !Elf_Int_DoRelocate(rela[i].r_info, ptr, rela[i].r_addend, dynsymtab, (Uint)Base) ) {\r
bFailed = 1;\r
}\r
}\r
return 0;\r
}\r
\r
- LEAVE('x', hdr->entrypoint);\r
- return hdr->entrypoint;\r
+ LEAVE('x', 1);\r
+ return 1;\r
}\r
\r
/**\r
// Relocate Library
if( !Binary_Relocate( (void*)base ) )
{
- Warning("[BIN ] Relocation of '%s' failed, unloading", sTruePath);
+ Log_Warning("BIN", "Relocation of '%s' failed, unloading", sTruePath);
Binary_Unload( (void*)base );
Binary_Dereference( pBinary );
LEAVE('n');
oldestPrev = prev;
}
}
+ if( !oldest ) {
+ Log_Error("IOCache", "Cache full, but also empty");
+ return -1;
+ }
// Remove from list, write back and free
oldestPrev->Next = oldest->Next;
if(oldest->LastWrite && Cache->Mode != IOCACHE_VIRTUAL)
}
// Remove from parent directory
- prev->Next = ent->Next;
+ if(prev)
+ prev->Next = ent->Next;
+ else
+ parent->Node.ImplPtr = ent->Next;
// Free if not in use
if(file->Node.ReferenceCount == 0)
#if !VERBOSE_DUMP
Log_Log("Heap", "%p (%P): 0x%08lx %i %4C",
head, MM_GetPhysAddr((Uint)head), head->Size, head->ValidSize, &head->Magic);
- Log_Log("Heap", "%p %4C", foot->Head, &foot->Magic);
+ if(foot)
+ Log_Log("Heap", "Backlink = %p %4C", foot->Head, &foot->Magic);
if(head->File) {
Log_Log("Heap", "%sowned by %s:%i",
(head->Magic==MAGIC_FREE?"was ":""), head->File, head->Line);
Log_Log("Heap", "%i blocks (0x%x bytes)", nBlocks, totalBytes);
Log_Log("Heap", "%i free blocks (0x%x bytes)", nFree, freeBytes);
- frag = (nFree-1)*10000/nBlocks;
+ if(nBlocks != 0)
+ frag = (nFree-1)*10000/nBlocks;
+ else
+ frag = 0;
Log_Log("Heap", "%i.%02i%% Heap Fragmentation", frag/100, frag%100);
avgAlloc = (totalBytes-freeBytes)/(nBlocks-nFree);
- overhead = (sizeof(tHeapFoot)+sizeof(tHeapHead))*10000/avgAlloc;
+ if(avgAlloc != 0)
+ overhead = (sizeof(tHeapFoot)+sizeof(tHeapHead))*10000/avgAlloc;
+ else
+ overhead = 0;
Log_Log("Heap", "Average allocation: %i bytes, Average Overhead: %i.%02i%%",
avgAlloc, overhead/100, overhead%100
);
// Convert arguments to integers
for( k = line->nParts-1; k--; )
{
- if( caConfigCommands[j].IntArgs & (1 << k) ) {
+ if( k < 32 && (caConfigCommands[j].IntArgs & (1 << k)) ) {
args[k] = atoi(line->Parts[k+1]);
}
else {
}
// If we fall onto the same queue again, special handling is
// needed
- if( i == Last->Priority ) {
+ if( Last && i == Last->Priority ) {
tThread *savedThread = thread;
// Find the next unscheduled thread in the list
{
rt = &Interface->Route;
// Make sure route is up to date
- memcpy(rt->Network, iface->Address, addrSize);
+ memcpy(rt->Network, Interface->Address, addrSize);
memset(rt->NextHop, 0, addrSize);
rt->Metric = DEFAUTL_METRIC;
- rt->SubnetBits = iface->SubnetBits;
+ rt->SubnetBits = Interface->SubnetBits;
if( IPStack_CompareAddress(AddressType, rt->Network, Address, rt->SubnetBits) )
{
data = (char*)Buffer + ofs;
- UDP_SendPacketTo(chan, ep->AddrType, &ep->Addr, ep->Port, Buffer, (size_t)Length - ofs);
+ UDP_SendPacketTo(chan, ep->AddrType, &ep->Addr, ep->Port, data, (size_t)Length - ofs);
return 0;
}
// Ensure the FDD version is 0x90
{
- Uint8 tmp;
+ Uint8 tmp = 0;
FDD_int_SendByte(cPORTBASE[0], CMD_VERSION);
FDD_int_GetByte(cPORTBASE[0], &tmp);
if( tmp != 0x90 ) {
*/
int FDD_int_SeekTrack(int disk, int head, int track)
{
- Uint8 sr0, cyl;
+ Uint8 sr0=0, cyl=0;
int base;
base = cPORTBASE[disk>>1];
}\r
}\r
\r
-#if USE_READLINE\r
+#if !USE_READLINE\r
/**\r
* \fn char *ReadCommandLine(int *Length)\r
* \brief Read from the command line\r