X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Fsystem.c;h=e09d469fffc05c1483c8bfca9c6b4fccfc24fe94;hb=aa62597b70c3f3753ee21b174ca695b6b6c4cdef;hp=d8eba8333db4ae5a67d9a6e8d71a888f9cf1e768;hpb=934d0f535e1929fd90ae0606e77794484aa55284;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/system.c b/KernelLand/Kernel/system.c index d8eba833..e09d469f 100644 --- a/KernelLand/Kernel/system.c +++ b/KernelLand/Kernel/system.c @@ -4,8 +4,9 @@ * system.c * - Architecture Independent System Init */ -#define DEBUG 0 +#define DEBUG 1 #include +#include // === IMPORTS === extern void Arch_LoadBootModules(void); @@ -44,11 +45,19 @@ void System_Init(char *CommandLine) // - Execute the Config Script Log_Log("Config", "Spawning init '%s'", gsInitBinary); - Proc_Spawn(gsInitBinary); + if(Proc_Clone(CLONE_VM|CLONE_NOUSER) == 0) + { + const char *args[] = {gsInitBinary, 0}; + VFS_Open("/Devices/pts/vt0", VFS_OPENFLAG_READ|VFS_OPENFLAG_USER); // 0: stdin + VFS_Open("/Devices/pts/vt0", VFS_OPENFLAG_WRITE|VFS_OPENFLAG_USER); // 1: stdout + VFS_DuplicateFD(1, 2); // 2: stderr + Proc_Execve(gsInitBinary, args, &args[1], 0); + Log_KernelPanic("System", "Unable to spawn init '%s'", gsInitBinary); + } // Set the debug to be echoed to the terminal Log_Log("Config", "Kernel now echoes to VT7 (Ctrl-Alt-F8)"); - Debug_SetKTerminal("/Devices/VTerm/7"); + Debug_SetKTerminal("/Devices/pts/vt7"); } /** @@ -156,7 +165,7 @@ void System_ParseVFS(char *Arg) // - Symbolic Link = if(value[0] == '/') { - Log_Log("Config", "Symbolic link '%s' pointing to '%s'", Arg, value); +// Log_Log("Config", "Symbolic link '%s' pointing to '%s'", Arg, value); VFS_Symlink(Arg, value); } // - Mount =: @@ -171,13 +180,13 @@ void System_ParseVFS(char *Arg) } // Create Mountpoint if( (fd = VFS_Open(Arg, 0)) == -1 ) { - Log_Log("Config", "Creating directory '%s'", Arg, value); +// Log_Log("Config", "Creating directory '%s'", Arg, value); VFS_MkDir( Arg ); } else { VFS_Close(fd); } // Mount - Log_Log("Config", "Mounting '%s' to '%s' ('%s')", dev, Arg, value); +// Log_Log("Config", "Mounting '%s' to '%s' ('%s')", dev, Arg, value); VFS_Mount(dev, Arg, value, ""); } }