-BUILD_NUM = 1590
+BUILD_NUM = 1601
for( i = 0; i < MAX_CALLBACKS_PER_IRQ; i++ )
{
if( gIRQ_Handlers[Num][i] == NULL ) {
- Log("IRQ_AddHandler: Added IRQ%i Cb#%i %p", Num, i, Callback);
+ Log_Log("IRQ", "Added IRQ%i Cb#%i %p", Num, i, Callback);
gIRQ_Handlers[Num][i] = Callback;
return 1;
}
}
- Warning("IRQ_AddHandler - No free callbacks on IRQ%i", Num);
+ Log_Warning("IRQ", "No free callbacks on IRQ%i", Num);
return 0;
}
Log("Initialising builtin modules...");
Modules_LoadBuiltins();
- Log("Loading Modules... (%i of them)", MbInfo->ModuleCount);
+ Log("Loading %i Modules...", MbInfo->ModuleCount);
// Load initial modules
mods = (void*)( MbInfo->Modules + KERNEL_BASE );
- Log("MbInfo = %p", MbInfo);
for( i = 0; i < MbInfo->ModuleCount; i ++ )
{
// Adjust into higher half
if( !Module_LoadMem( (void *)mods[i].Start, mods[i].End-mods[i].Start, (char *)mods[i].String ) )
{
- Warning("Unable to load module\n");
+ Log_Warning("ARCH", "Unable to load module\n");
}
- Log("Done. (MbInfo = %p)", MbInfo);
}
// Pass on to Independent Loader
void Debug_Fmt(const char *format, va_list *args)
{
char c, pad = ' ';
- int minSize = 0;
+ int minSize = 0, len;
char tmpBuf[34]; // For Integers
char *p = NULL;
int isLongLong = 0;
case 's':
p = (char*)(Uint)arg;
+ if(!p) p = "(null)";
+ len = strlen(p);
+ while(len++ < minSize) Debug_Putchar(pad);
printString:
if(!p) p = "(null)";
while(*p) Debug_Putchar(*p++);
.FindDir = SysFS_Comm_FindDir
}
};
-// Root of the SysFS tree (just used for clean code)
+// Root of the SysFS tree (just used to keep the code clean)
tSysFS_Ent gSysFS_Root = {
NULL, NULL,
NULL,
.Size = 1,
.ImplPtr = &gSysFS_Version,
.ImplInt = (Uint)&gSysFS_Root // Self-Link
- // .NumACLs = 1,
- // .ACLs = &gVFS_ACL_EveryoneRX,
- // .Flags = VFS_FFLAG_DIRECTORY,
- // .ReadDir = SysFS_Comm_ReadDir,
- // .FindDir = SysFS_Comm_FindDir
}
};
tDevFS_Driver gSysFS_DriverInfo = {
ent->Node.Size ++;
else
gSysFS_DriverInfo.RootNode.Size ++;
- Log("[SYSFS] Added directory '%s'", child->Name);
+ Log_Log("SysFS", "Added directory '%s'", child->Name);
}
ent = child;
break;
}
if( child ) {
- Warning("[SYSFS] '%s' is taken (in '%s')\n", &Path[start], Path);
+ Log_Warning("SysFS", "'%s' is taken (in '%s')\n", &Path[start], Path);
return 0;
}
child->ListNext = gSysFS_FileList;
gSysFS_FileList = child;
- Log("[SYSFS] Added '%s' (%p)", Path, Data);
+ Log_Log("SysFS", "Added '%s' (%p)", Path, Data);
return child->Node.Inode;
}
if( ent == file ) break;
}
if(!ent) {
- Warning("[SYSFS] Bookkeeping Error: File in list, but not in directory");
+ Log_Warning("SysFS", "Bookkeeping Error: File in list, but not in directory");
return 0;
}
break;
}
if( mod ) {
- Warning("[MOD ] Circular dependency detected");
+ Log_Warning("Module", "Circular dependency detected");
LEAVE_RET('i', -1);
}
break;
}
if( i == giNumBuiltinModules ) {
- Warning("[MOD ] Dependency '%s' for module '%s' failed");
+ Log_Warning("Module", "Dependency '%s' for module '%s' failed");
return -1;
}
// All Dependencies OK? Initialise
StartupPrint(Module->Name);
- Log("[MOD ] Initialising %p '%s' v%i.%i...",
+ Log_Log("Module", "Initialising %p '%s' v%i.%i...",
Module, Module->Name,
Module->Version >> 8, Module->Version & 0xFF
);
switch(ret)
{
case MODULE_ERR_MISC:
- Warning("[MOD ] Unable to load, reason: Miscelanious");
+ Log_Warning("Module", "Unable to load, reason: Miscelanious");
break;
case MODULE_ERR_NOTNEEDED:
- Warning("[MOD ] Unable to load, reason: Module not needed (probably hardware not found)");
+ Log_Warning("Module", "Unable to load, reason: Module not needed");
break;
case MODULE_ERR_MALLOC:
- Warning("[MOD ] Unable to load, reason: Error in malloc/realloc/calloc, probably not good");
+ Log_Warning("Module", "Unable to load, reason: Error in malloc/realloc/calloc, probably not good");
break;
default:
- Warning("[MOD ] Unable to load reason - Unknown code %i", ret);
+ Log_Warning("Module", "Unable to load reason - Unknown code %i", ret);
break;
}
LEAVE_RET('i', ret);
// Error check
if(base == NULL) {
- Warning("Module_LoadFile: Unable to load '%s'", Path);
+ Log_Warning("Module", "Module_LoadFile - Unable to load '%s'", Path);
return 0;
}
// Unknown module type?, return error
Binary_Unload(base);
#if USE_EDI
- Warning("Module_LoadFile: Module has neither a Module Info struct, nor an EDI entrypoint");
+ Log_Warning("Module", "Module '%s' has neither a Module Info struct, nor an EDI entrypoint", Path);
#else
- Warning("Module_LoadFile: Module does not have a Module Info struct");
+ Log_Warning("Module", "Module '%s' does not have a Module Info struct", Path);
#endif
return 0;
}
// Check magic number
if(info->Magic != MODULE_MAGIC)
{
- Warning("Module_LoadFile: Module's magic value is invalid (0x%x != 0x%x)", info->Magic, MODULE_MAGIC);
+ Log_Warning("Module", "Module's magic value is invalid (0x%x != 0x%x)", info->Magic, MODULE_MAGIC);
return 0;
}
// Check Architecture
if(info->Arch != MODULE_ARCH_ID)
{
- Warning("Module_LoadFile: Module is for a different architecture");
+ Log_Warning("Module", "Module is for a different architecture");
return 0;
}
return 0;
}
- Log("Initialising %p '%s' v%i.%i...",
+ Log_Log("Module", "Initialising %p '%s' v%i.%i...",
info,
info->Name,
info->Version>>8, info->Version & 0xFF
{
// Check if the module is loaded
if( !Module_IsLoaded(*names) ) {
- Warning("Module `%s' requires `%s', which is not loaded\n", Info->Name, *names);
+ Log_Warning("Module", "Module `%s' requires `%s', which is not loaded\n", Info->Name, *names);
return 0;
}
}
System_ParseCommandLine(ArgString);
// - Execute the Config Script
- Log("Executing config script...");
+ Log_Log("CFG", "Executing config script...");
System_ExecuteScript();
}
int i;
char *str;
- Log("Kernel Command Line: \"%s\"", ArgString);
+ Log_Log("CFG", "Kernel Invocation \"%s\"", ArgString);
// --- Get Arguments ---
str = ArgString;
// Check if the equals was found
if( *value == '\0' ) {
- Warning("Expected '=' in the string '%s'", Arg);
+ Log_Warning("CFG", "Expected '=' in the string '%s'", Arg);
return ;
}
// - Symbolic Link <link>=<destination>
if(value[0] == '/')
{
- Log("Symbolic link '%s' pointing to '%s'", Arg, value);
+ Log_Log("CFG", "Symbolic link '%s' pointing to '%s'", Arg, value);
VFS_Symlink(Arg, value);
}
// - Mount <mountpoint>=<fs>:<device>
}
// Create Mountpoint
if( (fd = VFS_Open(Arg, 0)) == -1 ) {
- Log("Creating directory '%s'", Arg, value);
+ Log_Log("CFG", "Creating directory '%s'", Arg, value);
VFS_MkDir( Arg );
} else {
VFS_Close(fd);
}
// Mount
- Log("Mounting '%s' to '%s' ('%s')", dev, Arg, value);
+ Log_Log("CFG", "Mounting '%s' to '%s' ('%s')", dev, Arg, value);
VFS_Mount(dev, Arg, value, "");
}
}
{
//if(strcmp(Arg, "") == 0) {
//} else {
- Warning("Kernel flag '%s' is not recognised", Arg);
+ Log_Warning("CFG", "Kernel flag '%s' is not recognised", Arg);
//}
}
else
value ++; // and eat it's position
if(strcmp(Arg, "SCRIPT") == 0) {
- Log("Config Script: '%s'", value);
+ Log_Log("CFG", "Config Script: '%s'", value);
gsConfigScript = value;
} else {
- Warning("Kernel config setting '%s' is not recognised", Arg);
+ Log_Warning("CFG", "Kernel config setting '%s' is not recognised", Arg);
}
}
// Open Script
fp = VFS_Open(gsConfigScript, VFS_OPENFLAG_READ);
if(fp == -1) {
- Warning("[CFG] Passed script '%s' does not exist", gsConfigScript);
+ Log_Warning("CFG", "Passed script '%s' does not exist", gsConfigScript);
return;
}
if( strcmp(line->Parts[0], "mount") == 0 )
{
if( line->nParts != 4 ) {
- Warning("Configuration command 'mount' requires 3 arguments, %i given",
+ Log_Warning("CFG", "Configuration command 'mount' requires 3 arguments, %i given",
line->nParts-1);
continue;
}
- //Log("[CFG ] Mount '%s' to '%s' (%s)",
+ //Log_Log("CFG", "Mount '%s' to '%s' (%s)",
// line->Parts[1], line->Parts[2], line->Parts[3]);
//! \todo Use an optional 4th argument for the options string
VFS_Mount(line->Parts[1], line->Parts[2], line->Parts[3], "");
else if(strcmp(line->Parts[0], "module") == 0)
{
if( line->nParts < 2 || line->nParts > 3 ) {
- Warning("Configuration command 'module' requires 1 or 2 arguments, %i given",
+ Log_Warning("CFG",
+ "Configuration command 'module' requires 1 or 2 arguments, %i given",
line->nParts-1);
continue;
}
else if(strcmp(line->Parts[0], "udimod") == 0)
{
if( line->nParts != 2 ) {
- Warning("Configuration command 'udimod' requires 1 argument, %i given",
+ Log_Warning("CFG", "Configuration command 'udimod' requires 1 argument, %i given",
line->nParts-1);
continue;
}
- Log("[CFG ] Load UDI Module '%s'", line->Parts[1]);
+ Log_Log("CFG", "Load UDI Module '%s'", line->Parts[1]);
Module_LoadFile(line->Parts[1], "");
}
// Load a EDI Module
else if(strcmp(line->Parts[0], "edimod") == 0)
{
if( line->nParts != 2 ) {
- Warning("Configuration command 'edimod' requires 1 argument, %i given",
+ Log_Warning("CFG", "Configuration command 'edimod' requires 1 argument, %i given",
line->nParts-1);
continue;
}
- Log("[CFG ] Load EDI Module '%s'", line->Parts[1]);
+ Log_Log("CFG", "Load EDI Module '%s'", line->Parts[1]);
Module_LoadFile(line->Parts[1], "");
}
// Create a Symbolic Link
else if(strcmp(line->Parts[0], "symlink") == 0)
{
if( line->nParts != 3 ) {
- Warning("Configuration command 'symlink' requires 2 arguments, %i given",
+ Log_Warning("CFG", "Configuration command 'symlink' requires 2 arguments, %i given",
line->nParts-1);
continue;
}
- Log("[CFG ] Symlink '%s' pointing to '%s'",
+ Log_Log("CFG", "Symlink '%s' pointing to '%s'",
line->Parts[1], line->Parts[2]);
VFS_Symlink(line->Parts[1], line->Parts[2]);
}
else if(strcmp(line->Parts[0], "mkdir") == 0)
{
if( line->nParts != 2 ) {
- Warning("Configuration command 'mkdir' requires 1 argument, %i given",
+ Log_Warning("CFG", "Configuration command 'mkdir' requires 1 argument, %i given",
line->nParts-1);
continue;
}
- Log("[CFG ] New Directory '%s'", line->Parts[1]);
+ Log_Log("CFG", "New Directory '%s'", line->Parts[1]);
VFS_MkDir(line->Parts[1]);
}
// Spawn a process
else if(strcmp(line->Parts[0], "spawn") == 0)
{
if( line->nParts != 2 ) {
- Warning("Configuration command 'spawn' requires 1 argument, %i given",
+ Log_Warning("CFG", "Configuration command 'spawn' requires 1 argument, %i given",
line->nParts-1);
continue;
}
- Log("[CFG ] Starting '%s' as a new task", line->Parts[1]);
+ Log_Log("CFG", "Starting '%s' as a new task", line->Parts[1]);
Proc_Spawn(line->Parts[1]);
}
else {
- Warning("Unknown configuration command '%s' on line %i",
+ Log_Warning("CFG", "Unknown configuration command '%s' on line %i",
line->Parts[0],
line->TrueLine
);
*/
void VFS_GetMemPath(char *Dest, void *Base, Uint Length)
{
- Log("VFS_GetMemPath: (Base=%p, Length=0x%x, Dest=%p)", Base, Length, Dest);
Dest[0] = '$';
itoa( &Dest[1], (Uint)Base, 16, BITS/4, '0' );
Dest[BITS/4+1] = ':';
itoa( &Dest[BITS/4+2], Length, 16, BITS/4, '0' );
Dest[BITS/2+2] = '\0';
-
- Log("VFS_GetMemPath: Dest = \"%s\"", Dest);
}
/**
// Check for NULL byte
if(*str != '\0') return NULL;
- Log(" VFS_MemFile_Create: base=0x%x, size=0x%x", base, size);
-
// Allocate and fill node
ret = malloc(sizeof(tVFS_Node));
memset(ret, 0, sizeof(tVFS_Node));
// Get the filesystem
fs = VFS_GetFSByName(Filesystem);
if(!fs) {
- Warning("VFS_Mount - Unknown FS Type '%s'", Filesystem);
+ Log_Warning("VFS", "VFS_Mount - Unknown FS Type '%s'", Filesystem);
return -1;
}
}
RELEASE( &glVFS_MountList );
- Log("VFS_Mount: Mounted '%s' to '%s' ('%s')", Device, MountPoint, Filesystem);
+ Log_Log("VFS", "Mounted '%s' to '%s' ('%s')", Device, MountPoint, Filesystem);
VFS_UpdateMountFile();
//Open device and read boot sector\r
diskInfo->fileHandle = VFS_Open(Device, VFS_OPENFLAG_READ|VFS_OPENFLAG_WRITE);\r
if(diskInfo->fileHandle == -1) {\r
- Warning("FAT_InitDisk - Unable to open device '%s'", Device);\r
+ Log_Warning("FAT", "Unable to open device '%s'", Device);\r
return NULL;\r
}\r
\r
VFS_ReadAt(diskInfo->fileHandle, 0, 512, bs);\r
\r
if(bs->bps == 0 || bs->spc == 0) {\r
- Warning("FAT_InitDisk - Error in FAT Boot Sector\n");\r
+ Log_Warning("FAT", "Error in FAT Boot Sector\n");\r
return NULL;\r
}\r
\r
sSize = "GiB";\r
iSize >>= 20;\r
}\r
- Log("[FAT ] '%s' %s, %i %s", Device, sFatType, iSize, sSize);\r
+ Log_Log("FAT", "'%s' %s, %i %s", Device, sFatType, iSize, sSize);\r
}\r
#endif\r
\r
Uint32 Ofs;\r
diskInfo->FATCache = (Uint32*)malloc(sizeof(Uint32)*diskInfo->ClusterCount);\r
if(diskInfo->FATCache == NULL) {\r
- Warning("FAT_InitDisk - Heap Exhausted\n");\r
+ Log_Warning("FAT", "Heap Exhausted\n");\r
return NULL;\r
}\r
Ofs = bs->resvSectCount*512;\r
#else\r
Uint32 val;\r
//Uint8 buf[512];\r
- Warning("[FAT ] TODO: Implement cluster allocation with non cached FAT");\r
+ Log_Warning("FAT", "TODO: Implement cluster allocation with non cached FAT");\r
return 0;\r
\r
if(Disk->type == FAT12) {\r
{\r
cluster = FAT_int_GetFatValue( disk, cluster );\r
if(cluster == -1) {\r
- Warning("[FAT ] EOC Unexpectedly Reached");\r
+ Log_Warning("FAT", "EOC Unexpectedly Reached");\r
return 0;\r
}\r
Offset -= disk->BytesPerCluster;\r
// Bounds Checking (Used to spot heap overflows)\r
if(cluster > disk->ClusterCount + 2)\r
{\r
- Warning("FAT_ReadDir - Cluster ID is over cluster count (0x%x>0x%x)",\r
+ Log_Warning("FAT", "Cluster ID is over cluster count (0x%x>0x%x)",\r
cluster, disk->ClusterCount+2);\r
LEAVE('n');\r
return NULL;\r
}
if( giNe2k_CardCount == 0 ) {
- Warning("[Ne2k ] No cards detected");
+ Log_Warning("Ne2k", "No cards detected");
return MODULE_ERR_NOTNEEDED;
}
Ne2k_WriteReg(base, MAC5, gpNe2k_Cards[ k ].MacAddr[5]);
*/
- Log_Log("NE2K", "Card %i 0x%04x %02x:%02x:%02x:%02x:%02x:%02x",
- k, base,
+ Log_Log("Ne2k", "Card %i 0x%04x IRQ%i %02x:%02x:%02x:%02x:%02x:%02x",
+ k, base, gpNe2k_Cards[ k ].IRQ,
gpNe2k_Cards[k].MacAddr[0], gpNe2k_Cards[k].MacAddr[1],
gpNe2k_Cards[k].MacAddr[2], gpNe2k_Cards[k].MacAddr[3],
gpNe2k_Cards[k].MacAddr[4], gpNe2k_Cards[k].MacAddr[5]
);
- Log("[NE2K]: Card #%i: IRQ=%i, IOBase=0x%x",
- k, gpNe2k_Cards[ k ].IRQ, gpNe2k_Cards[ k ].IOBase);
- Log("MAC Address %x:%x:%x:%x:%x:%x",
- gpNe2k_Cards[ k ].MacAddr[0], gpNe2k_Cards[ k ].MacAddr[1],
- gpNe2k_Cards[ k ].MacAddr[2], gpNe2k_Cards[ k ].MacAddr[3],
- gpNe2k_Cards[ k ].MacAddr[4], gpNe2k_Cards[ k ].MacAddr[5]
- );
-
// Set VFS Node
gpNe2k_Cards[ k ].Name[0] = '0'+k;
gpNe2k_Cards[ k ].Name[1] = '\0';
// Sanity Check Length
if(Length > TX_BUF_SIZE*256) {
- Warning(
+ Log_Warning(
+ "Ne2k",
"Ne2k_Write - Attempting to send over TX_BUF_SIZE*256 (%i) bytes (%i)",
TX_BUF_SIZE*256, Length
);
return ;
}
}
- Warning("[NE2K ] Recieved Unknown IRQ %i", IntNum);
+ Log_Warning("Ne2k", "Recieved Unknown IRQ %i", IntNum);
}