-BUILD_NUM = 1541
+BUILD_NUM = 1556
// Load Virtual Filesystem
VFS_Init();
- Log("Loading Modules...");
+ Log("Loading Modules... (%i of them)", MbInfo->ModuleCount);
// Load initial modules
mods = (void*)( MbInfo->Modules + KERNEL_BASE );
- for(i=0;i<MbInfo->ModuleCount;i++)
+ Log("MbInfo = %p", MbInfo);
+ for( i = 0; i < MbInfo->ModuleCount; i ++ )
{
// Adjust into higher half
mods[i].Start += KERNEL_BASE;
{
Warning("Unable to load module\n");
}
+ Log("Done. (MbInfo = %p)", MbInfo);
}
// Pass on to Independent Loader
System_Init( (char*)(MbInfo->CommandLine + KERNEL_BASE) );
// Sleep forever (sleeping beauty)
- for(;;) Threads_Sleep();
+ for(;;)
+ Threads_Sleep();
return 0;
}
}\r
\r
// Read Program Header Table\r
- phtab = malloc(sizeof(Elf32_Phdr)*hdr.phentcount);\r
+ phtab = malloc( sizeof(Elf32_Phdr) * hdr.phentcount );\r
+ if( !phtab ) {\r
+ LEAVE('n');\r
+ return NULL;\r
+ }\r
+ LOG("hdr.phoff = 0x%08x", hdr.phoff);\r
VFS_Seek(fp, hdr.phoff, SEEK_SET);\r
VFS_Read(fp, sizeof(Elf32_Phdr)*hdr.phentcount, phtab);\r
\r
for( i = 0; i < hdr.phentcount; i++ )\r
{\r
int lastSize;\r
- LOG("phtab[%i].Type = 0x%x", i, phtab[i].Type);\r
+ //LOG("phtab[%i].Type = 0x%x", i, phtab[i].Type);\r
+ LOG("phtab[%i] = {", i);\r
+ LOG(" .Type = 0x%08x", phtab[i].Type);\r
+ LOG(" .Offset = 0x%08x", phtab[i].Offset);\r
+ LOG(" .VAddr = 0x%08x", phtab[i].VAddr);\r
+ LOG(" .PAddr = 0x%08x", phtab[i].PAddr);\r
+ LOG(" .FileSize = 0x%08x", phtab[i].FileSize);\r
+ LOG(" .MemSize = 0x%08x", phtab[i].MemSize);\r
+ LOG(" .Flags = 0x%08x", phtab[i].Flags);\r
+ LOG(" .Align = 0x%08x", phtab[i].Align);\r
+ LOG(" }");\r
// Get Interpreter Name\r
if( phtab[i].Type == PT_INTERP )\r
{\r
\r
struct sElf32_Phdr {\r
Uint32 Type;\r
- Uint Offset;\r
- Uint VAddr;\r
- Uint PAddr;\r
+ Uint32 Offset;\r
+ Uint32 VAddr;\r
+ Uint32 PAddr;\r
Uint32 FileSize;\r
Uint32 MemSize;\r
Uint32 Flags;\r
sTruePath = VFS_GetTruePath(file);\r
\r
if(sTruePath == NULL) {\r
- Warning("[BIN ] '%s' does not exist.", file);\r
+ Warning("[BIN ] '%s' does not exist.", file);\r
LEAVE('x', 0);\r
return 0;\r
}\r
// === CONSTANTS ===
//! Maximum size of a Memory Path generated by VFS_GetMemPath
-#define VFS_MEMPATH_SIZE (3 + (BITS/8)*2)
+#define VFS_MEMPATH_SIZE (3 + (BITS/4)*2)
/**
* \name Flags for VFS_Open
* \{
// === GLOBALS ===
int giNumBuiltinModules = 0;
- int giModuleSpinlock = 0;
+tSpinlock glModuleSpinlock;
tModule *gLoadedModules = NULL;
tModuleLoader *gModule_Loaders = NULL;
tModule *gLoadingModules = NULL;
ret = Module->Init(NULL);
if( ret != MODULE_ERR_OK ) {
- Log("[MOD ] Loading Failed, all modules that depend on this will also fail");
switch(ret)
{
case MODULE_ERR_MISC:
- Log("[MOD ] Reason: Miscelanious");
+ Warning("[MOD ] Unable to load, reason: Miscelanious");
break;
case MODULE_ERR_NOTNEEDED:
- Log("[MOD ] Reason: Module not needed (probably hardware not found)");
+ Warning("[MOD ] Unable to load, reason: Module not needed (probably hardware not found)");
break;
case MODULE_ERR_MALLOC:
- Log("[MOD ] Reason: Error in malloc/realloc/calloc, probably not good");
+ Warning("[MOD ] Unable to load, reason: Error in malloc/realloc/calloc, probably not good");
break;
default:
- Log("[MOD ] Reason - Unknown code %i", ret);
+ Warning("[MOD ] Unable to load reason - Unknown code %i", ret);
break;
}
LEAVE_RET('i', ret);
+ return ret;
}
// Remove from loading list
gLoadingModules = gLoadingModules->Next;
// Add to loaded list
+ LOCK( &glModuleSpinlock );
Module->Next = gLoadedModules;
gLoadedModules = Module;
+ RELEASE( &glModuleSpinlock );
LEAVE_RET('i', 0);
}
return 0;
}
+ #if 1
+ if( Module_int_Initialise( info ) )
+ {
+ Binary_Unload(base);
+ return 0;
+ }
+ #else
// Resolve Dependencies
if( !Module_int_ResolveDeps(info) ) {
Binary_Unload(base);
}
// Add to list
- LOCK( &giModuleSpinlock );
+ LOCK( &glModuleSpinlock );
info->Next = gLoadedModules;
gLoadedModules = info;
- RELEASE( &giModuleSpinlock );
+ RELEASE( &glModuleSpinlock );
+ #endif
return 1;
}
if( !Syscall_ValidString(Regs->Arg1)
|| !Syscall_Valid(sizeof(Uint), Regs->Arg2) ) {
err = -EINVAL;
- ret = -1;
+ ret = 0;
break;
}
// Path, *Entrypoint
int VFS_AddDriver(tVFS_Driver *Info);
void VFS_UpdateDriverFile();
+// === EXPORTS ===
+EXPORT(VFS_AddDriver);
+
// === GLOBALS ===
tVFS_Node NULLNode = {0};
tSpinlock siDriverListLock = 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);
}
+<?php
+$lGenDate = date("Y-m-d H:i");
+$gOutput = <<<EOF
/*
* Acess2 InitRD
* InitRD Data
- * Generated <?php echo date("Y-m-d H:i"),"\n"; ?>
+ * Generated $lGenDate
*/
#include "initrd.h"
-<?php
+
+EOF;
+
$lines = file($argv[1]);
$lDepth = 0;
$lStack[$lDepth][1][] = array($matches[1], $matches[2]);
continue;
}
+ echo "ERROR: $line\n";
+ exit(0);
}
function hd($fp)
function ProcessFolder($prefix, $items)
{
+ global $gOutput;
foreach($items as $i=>$item)
{
- if(is_array($item[1])) {
-
+ if(is_array($item[1]))
+ {
ProcessFolder("{$prefix}_{$i}", $item[1]);
- echo "tInitRD_File {$prefix}_{$i}_entries[] = {\n";
+ $gOutput .= "tInitRD_File {$prefix}_{$i}_entries[] = {\n";
foreach($item[1] as $j=>$child)
{
- if($j) echo ",\n";
- echo "\t{\"".addslashes($child[0])."\",&{$prefix}_{$i}_{$j}}";
+ if($j) $gOutput .= ",\n";
+ $gOutput .= "\t{\"".addslashes($child[0])."\",&{$prefix}_{$i}_{$j}}";
}
- echo "\n};\n";
+ $gOutput .= "\n};\n";
$size = count($item[1]);
- echo <<<EOF
+ $gOutput .= <<<EOF
tVFS_Node {$prefix}_{$i} = {
.NumACLs = 1,
.ACLs = &gVFS_ACL_EveryoneRX,
EOF;
}
else {
+ if(!file_exists($item[1])) {
+ echo "ERROR: '{$item[1]}' does not exist\n",
+ exit(1);
+ }
$size = filesize($item[1]);
- echo "Uint8 {$prefix}_{$i}_data[] = {\n";
+ $gOutput .= "Uint8 {$prefix}_{$i}_data[] = {\n";
$fp = fopen($item[1], "rb");
for( $j = 0; $j + 16 < $size; $j += 16 )
{
- echo "\t";
- echo hd($fp),",",hd($fp),",";
- echo hd($fp),",",hd($fp),",";
- echo hd($fp),",",hd($fp),",";
- echo hd($fp),",",hd($fp),",";
- echo hd($fp),",",hd($fp),",";
- echo hd($fp),",",hd($fp),",";
- echo hd($fp),",",hd($fp),",";
- echo hd($fp),",",hd($fp),",\n";
+ $gOutput .= "\t";
+ $gOutput .= hd($fp).",".hd($fp).",";
+ $gOutput .= hd($fp).",".hd($fp).",";
+ $gOutput .= hd($fp).",".hd($fp).",";
+ $gOutput .= hd($fp).",".hd($fp).",";
+ $gOutput .= hd($fp).",".hd($fp).",";
+ $gOutput .= hd($fp).",".hd($fp).",";
+ $gOutput .= hd($fp).",".hd($fp).",";
+ $gOutput .= hd($fp).",".hd($fp).",\n";
}
- echo "\t";
+ $gOutput .= "\t";
for( ; $j < $size; $j ++ )
{
- if( $j & 15 ) echo ",";
- echo hd($fp);
+ if( $j & 15 ) $gOutput .= ",";
+ $gOutput .= hd($fp);
}
fclose($fp);
- echo "\n};\n";
- echo <<<EOF
+ $gOutput .= "\n};\n";
+ $gOutput .= <<<EOF
tVFS_Node {$prefix}_{$i} = {
.NumACLs = 1,
.ACLs = &gVFS_ACL_EveryoneRX,
}
}
+//print_r($lStack);
+//exit(1);
+
ProcessFolder("gInitRD_Files", $lStack[0][1]);
-echo "tInitRD_File gInitRD_Root_Files[] = {\n";
+$gOutput .= "tInitRD_File gInitRD_Root_Files[] = {\n";
foreach($lStack[0][1] as $j=>$child)
{
- if($j) echo ",\n";
- echo "\t{\"".addslashes($child[0])."\",&gInitRD_Files_{$j}}";
+ if($j) $gOutput .= ",\n";
+ $gOutput .= "\t{\"".addslashes($child[0])."\",&gInitRD_Files_{$j}}";
}
-echo "\n};\n";
-?>
+$gOutput .= "\n};\n";
+$nRootFiles = count($lStack[0][1]);
+$gOutput .= <<<EOF
tVFS_Node gInitRD_RootNode = {
.NumACLs = 1,
.ACLs = &gVFS_ACL_EveryoneRX,
.Flags = VFS_FFLAG_DIRECTORY,
- .Size = <?php echo count($lStack[0][1]);?>,
+ .Size = $nRootFiles,
.ImplPtr = gInitRD_Root_Files,
.ReadDir = InitRD_ReadDir,
.FindDir = InitRD_FindDir
};
+EOF;
+
+$fp = fopen($argv[2], "w");
+fputs($fp, $gOutput);
+fclose($fp);
+?>
-include ../Makefile.tpl
-files.c:
- php GenerateInitRD.php files.lst > files.c
+files.c: GenerateInitRD.php files.lst
+ php GenerateInitRD.php files.lst files.c
Dir "Bin" {
File "CLIShell" "../../../Usermode/Applications/CLIShell"
File "ls" "../../../Usermode/Applications/ls"
+ File "cat" "../../../Usermode/Applications/cat"
+}
+Dir "Libs" {
+ File "ld-acess.so" "../../../Usermode/Libraries/ld-acess.so"
+ File "libacess.so" "../../../Usermode/Libraries/libacess.so"
+ File "libc.so.1" "../../../Usermode/Libraries/libc.so.1"
+ File "libgcc.so" "../../../Usermode/Libraries/libgcc.so"
+}
+Dir "Conf" {
+ File "BootConf.cfg" "../../../Usermode/Filesystem/Conf/BootConf.cfg"
}
if(Offset + Length > Node->Size)
Length = Node->Size - Offset;
- memcpy(Buffer, Node->ImplPtr, Length);
+ memcpy(Buffer, Node->ImplPtr+Offset, Length);
return Length;
}
int i;
tInitRD_File *dir = Node->ImplPtr;
+ Log("InirRD_FindDir: Name = '%s'", Name);
+
for( i = 0; i < Node->Size; i++ )
{
if(strcmp(Name, dir[i].Name) == 0)
-module /Acess/Modules/bochsvbe.kmd
+#module /Acess/Modules/bochsvbe.kmd
#module /Acess/Modules/ps2mouse
#edimod /Acess/Modules/serial.edi
#module /Acess/Modules/ne2000.akm
\r
// Create Temp Name\r
filename = FindLibrary(sTmpName, SoName, SearchDir);\r
+ if(filename == NULL) {\r
+ DEBUGS("LoadLibrary: RETURN 0\n");\r
+ return 0;\r
+ }\r
DEBUGS(" LoadLibrary: filename='%s'\n", filename);\r
\r
if( (iArg = IsFileLoaded(filename)) )\r