int giKB_KeyLayer = 0;
#if USE_KERNEL_MAGIC
int gbKB_MagicState = 0;
+ int giKB_MagicAddress = 0;
+ int giKB_MagicAddressPos = 0;
#endif
//Uint64 giKB_ReadBase = 0;
//Uint32 gaKB_Buffer[KB_BUFFER_SIZE]; //!< Keyboard Ring Buffer
{
switch(ch)
{
- // Kernel Panic (Page Fault)
- case 'q': *((int*)1) = 0; return;
- // Bochs Magic Breakpoint
- case 'd': __asm__ __volatile__ ("xchg %bx, %bx"); return;
+ case '0': case '1': case '2': case '3':
+ case '4': case '5': case '6': case '7':
+ case '8': case '9': case 'a': case 'b':
+ case 'c': case 'd': case 'e': case 'f':
+ {
+ char str[2] = {ch,0};
+ if(giKB_MagicAddressPos == BITS/4) break;
+ giKB_MagicAddress |= atoi(str) << giKB_MagicAddressPos;
+ giKB_MagicAddressPos ++;
+ }
+ break;
+
// Thread List Dump
case 'p': Threads_Dump(); return;
// Heap Statistics
case 'h': Heap_Stats(); return;
+ // Dump Structure
+ case 's': return;
}
}
#endif
struct sThread *GlobalPrev; //!< Previous thread in global list
tShortSpinlock IsLocked; //!< Thread's spinlock
volatile int Status; //!< Thread Status
+ void *WaitPointer; //!< What (Mutex/Thread/other) is the thread waiting on
int RetStatus; //!< Return Status
Uint TID; //!< Thread ID
THREAD_STAT_NULL, // Invalid process
THREAD_STAT_ACTIVE, // Running and schedulable process
THREAD_STAT_SLEEPING, // Message Sleep
- THREAD_STAT_OFFSLEEP, // Mutex Sleep (or waiting on a thread)
- THREAD_STAT_WAITING, // ???
+ THREAD_STAT_MUTEXSLEEP, // Mutex Sleep
+ THREAD_STAT_WAITING, // ??? (Waiting for a thread)
THREAD_STAT_PREINIT, // Being created
THREAD_STAT_ZOMBIE, // Died, just not removed
THREAD_STAT_DEAD // Why do we care about these???
return NULL;
}
+ ret->Next = NULL;
ret->Remaining = 0;
ret->CurCPU = -1;
Log(" %i (%i) - %s (CPU %i)",
thread->TID, thread->TGID, thread->ThreadName, thread->CurCPU);
Log(" State %i", thread->Status);
+ switch(thread->Status)
+ {
+ case THREAD_STAT_MUTEXSLEEP:
+ Log(" Mutex Pointer: %p", thread->WaitPointer);
+ break;
+ case THREAD_STAT_ZOMBIE:
+ Log(" Return Status: %i", thread->RetStatus);
+ break;
+ default: break;
+ }
Log(" Priority %i, Quantum %i", thread->Priority, thread->Quantum);
Log(" KStack 0x%x", thread->KernelStack);
}
SHORTLOCK( &glThreadListLock );
// - Remove from active list
us = Threads_RemActive();
+ us->Next = NULL;
// - Mark as sleeping
- us->Status = THREAD_STAT_OFFSLEEP;
+ us->Status = THREAD_STAT_MUTEXSLEEP;
+ us->WaitPointer = Mutex;
// - Add to waiting
if(Mutex->LastWaiting) {
Mutex->Waiting = us;
Mutex->LastWaiting = us;
}
+ #if 1
+ {
+ int i = 0;
+ tThread *t;
+ for( t = Mutex->Waiting; t; t = t->Next, i++ )
+ Log("[%i] (tMutex)%p->Waiting[%i] = %p (%i %s)", us->TID, Mutex, i,
+ t, t->TID, t->ThreadName);
+ }
+ #endif
+
SHORTREL( &glThreadListLock );
SHORTREL( &Mutex->Protector );
- while(us->Status == THREAD_STAT_OFFSLEEP) Threads_Yield();
+ while(us->Status == THREAD_STAT_MUTEXSLEEP) Threads_Yield();
// We're only woken when we get the lock
+ us->WaitPointer = NULL;
}
// Ooh, let's take it!
else {
/*
- * AcessMicro VFS
+ * Acess2 VFS
* - Open, Close and ChDir
*/
-#define DEBUG 0
+#define DEBUG 1
#include <acess.h>
#include <mm_virt.h>
#include "vfs.h"
longestMount = mnt;
}
- // Sanity Check
- /*if(!longestMount) {
- Log("VFS_ParsePath - ERROR: No Root Node\n");
- return NULL;
- }*/
-
// Save to shorter variable
mnt = longestMount;
LEAVE('n');
return NULL;
}
- LOG("FindDir(%p, '%s')", curNode, pathEle);
+ LOG("FindDir{=%p}(%p, '%s')", curNode->FindDir, curNode, pathEle);
// Get Child Node
tmpNode = curNode->FindDir(curNode, pathEle);
LOG("tmpNode = %p", tmpNode);
- if(curNode->Close) curNode->Close(curNode);
+ if(curNode->Close) {
+ //LOG2("curNode->Close = %p", curNode->Close);
+ curNode->Close(curNode);
+ }
curNode = tmpNode;
// Error Check
* \todo Implement changing of the parent directory when a file is written to\r
* \todo Implement file creation / deletion\r
*/\r
-#define DEBUG 0\r
+#define DEBUG 1\r
#define VERBOSE 1\r
\r
#define CACHE_FAT 0 //!< Caches the FAT in memory\r
sPassword = GetPassword();
if( (uid = ValidateUser(sUsername, sPassword)) == -1 )
{
- printf("\nInvalid username or password for '%s'\n", sUsername);
+ printf("\nInvalid username or password\n");
free(sUsername);
free(sPassword);
}