*.gz
*.img
SrcDoc/
-ApiDoc/
+APIDoc/
Usermode/Output/
gitstats/
.*.swp
+.*
obj-*/
#endif
// === FLAGS ===
-#define DEBUG_TRACE_SWITCH 1
+#define DEBUG_TRACE_SWITCH 0
#define DEBUG_DISABLE_DOUBLEFAULT 1
+#define DEBUG_VERY_SLOW_SWITCH 0
// === CONSTANTS ===
#define SWITCH_MAGIC 0xFF5317C8 // FF SWITCH - There is no code in this area
// Base is 1193182
#define TIMER_BASE 1193182
-#define TIMER_DIVISOR 11932 //~100Hz
+#if DEBUG_VERY_SLOW_PERIOD
+# define TIMER_DIVISOR 1193 //~10Hz switch, with 10 quantum = 1s per thread
+#else
+# define TIMER_DIVISOR 11932 //~100Hz
+#endif
// === TYPES ===
#if USE_MP
thread = Threads_GetNextToRun(CPU, thread);
- #if DEBUG_TRACE_SWITCH
- if(thread) {
- Log("Switching to task %i(%s), CR3 = 0x%x, EIP = %p",
- thread->TID,
- thread->ThreadName,
- thread->MemState.CR3,
- thread->SavedState.EIP
- );
- }
- #endif
-
// No avaliable tasks, just go into low power mode (idle thread)
if(thread == NULL) {
#if USE_MP
#endif
}
+ #if DEBUG_TRACE_SWITCH
+ if(thread && thread != Proc_GetCurThread() ) {
+ Log("Switching to task %i(%s), CR3 = 0x%x, EIP = %p",
+ thread->TID,
+ thread->ThreadName,
+ thread->MemState.CR3,
+ thread->SavedState.EIP
+ );
+ }
+ #endif
+
// Set current thread
#if USE_MP
gaCPUs[CPU].Current = thread;
// Print the block info?
#if 1
- Log_Debug("Heap", "%p (0x%x) - 0x%x (%i) Owned by %s:%i",
- head->Data, MM_GetPhysAddr((tVAddr)&head->Data), head->Size, head->ValidSize, head->File, head->Line);
+ if( head->Magic == MAGIC_FREE )
+ Log_Debug("Heap", "%p (0x%llx) - 0x%x free",
+ head->Data, MM_GetPhysAddr((tVAddr)&head->Data), head->Size);
+ else
+ Log_Debug("Heap", "%p (0x%llx) - 0x%x (%i) Owned by %s:%i",
+ head->Data, MM_GetPhysAddr((tVAddr)&head->Data), head->Size, head->ValidSize, head->File, head->Line);
#endif
}
// Configuration
#define DEBUG_TRACE_TICKETS 0 // Trace ticket counts
#define DEBUG_TRACE_STATE 0 // Trace state changes (sleep/wake)
+#define SEMAPHORE_DEBUG 0
// --- Schedulers ---
#define SCHED_UNDEF 0
// Set state
Thread->Status = THREAD_STAT_ACTIVE;
+// Thread->CurCPU = -1;
// Add to active list
#if SCHEDULER_TYPE == SCHED_RR_PRI
Thread->Next = gaActiveThreads[Thread->Priority];
// Clear Delete Queue
// - I should probably put this in a worker thread to avoid calling free() in the scheduler
// DEFINITELY - free() can deadlock in this case
+ // I'll do it when it becomes an issue
while(gDeleteThreads)
{
thread = gDeleteThreads->Next;
}
gDeleteThreads = thread;
}
-
+
+ // Make sure the current (well, old) thread is marked as de-scheduled
+ if(Last) Last->CurCPU = -1;
+
// No active threads, just take a nap
if(giNumActiveThreads == 0) {
SHORTREL( &glThreadListLock );
Sem->LastWaiting = us;
}
- #if DEBUG_TRACE_STATE
+ #if DEBUG_TRACE_STATE || SEMAPHORE_DEBUG
Log("%p (%i %s) waiting on semaphore %p %s:%s",
us, us->TID, us->ThreadName,
Sem, Sem->ModName, Sem->Name);
#endif
+ SHORTREL( &Sem->Protector ); // Release first to make sure it is released
SHORTREL( &glThreadListLock );
- SHORTREL( &Sem->Protector );
while(us->Status == THREAD_STAT_SEMAPHORESLEEP) Threads_Yield();
// We're only woken when there's something avaliable
us->WaitPointer = NULL;
Sem->Value -= given;
- #if DEBUG_TRACE_STATE
+ #if DEBUG_TRACE_STATE || SEMAPHORE_DEBUG
Log("%p (%i %s) woken by wait on %p %s:%s",
toWake, toWake->TID, toWake->ThreadName,
Sem, Sem->ModName, Sem->Name);
Sem->LastSignaling = us;
}
- #if DEBUG_TRACE_STATE
+ #if DEBUG_TRACE_STATE || SEMAPHORE_DEBUG
Log("%p (%i %s) signaling semaphore %p %s:%s",
us, us->TID, us->ThreadName,
Sem, Sem->ModName, Sem->Name);
if(toWake->bInstrTrace)
Log("%s(%i) given %i from %p", toWake->ThreadName, toWake->TID, given, Sem);
- #if DEBUG_TRACE_STATE
+ #if DEBUG_TRACE_STATE || SEMAPHORE_DEBUG
Log("%p (%i %s) woken by signal on %p %s:%s",
toWake, toWake->TID, toWake->ThreadName,
Sem, Sem->ModName, Sem->Name);
SHORTLOCK( &glThreadListLock );
if( toWake->Status != THREAD_STAT_ACTIVE )
Threads_AddActive(toWake);
+ else
+ Warning("Thread %p (%i %s) is already awake", toWake, toWake->TID, toWake->ThreadName);
SHORTREL( &glThreadListLock );
}
SHORTREL( &Sem->Protector );
// Get absolue path name
_link = VFS_GetAbsPath( Link );
if(!_link) {
- Warning("Path '%s' is badly formed", Link);
+ Log_Warning("VFS", "Path '%s' is badly formed", Link);
return -1;
}
// Check if destination exists
if(!destNode) {
- Warning("File '%s' does not exist, symlink not created", Link);
+ Log_Warning("VFS", "File '%s' does not exist, symlink not created", Link);
return -1;
}
// Make node
if( VFS_MkNod(Name, VFS_FFLAG_SYMLINK) != 0 ) {
- Warning("Unable to create link node '%s'", Name);
+ Log_Warning("VFS", "Unable to create link node '%s'", Name);
return -2; // Make link node
}
int FDD_int_GetDims(int type, int lba, int *c, int *h, int *s, int *spt);
// === GLOBALS ===
-MODULE_DEFINE(0, FDD_VERSION, FDD, FDD_Install, NULL, "ISADMA", NULL);
+MODULE_DEFINE(0, FDD_VERSION, FDD, FDD_Install, NULL, "x86_ISADMA", NULL);
t_floppyDevice gFDD_Devices[2];
tMutex glFDD;
volatile int gbFDD_IrqFired = 0;
* Acess2 GUI Test App
* - By John Hodge (thePowersGang)
*/
-#include <axwin/axwin.h>
+#include <axwin2/axwin.h>
// === PROTOTYPES ===
int main(int argc, char *argv[]);