git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Kernel/debug - Clean up Debug() method, bind to #define config
[tpg/acess2.git]
/
KernelLand
/
Kernel
/
system.c
diff --git
a/KernelLand/Kernel/system.c
b/KernelLand/Kernel/system.c
index
e09d469
..
9892af3
100644
(file)
--- a/
KernelLand/Kernel/system.c
+++ b/
KernelLand/Kernel/system.c
@@
-14,6
+14,7
@@
extern int Modules_LoadBuiltins(void);
extern void Modules_SetBuiltinParams(char *Name, char *ArgString);
extern void Debug_SetKTerminal(const char *File);
extern void Timer_CallbackThread(void *);
extern void Modules_SetBuiltinParams(char *Name, char *ArgString);
extern void Debug_SetKTerminal(const char *File);
extern void Timer_CallbackThread(void *);
+extern void EmergencyConsole(void);
// === PROTOTYPES ===
void System_Init(char *Commandline);
// === PROTOTYPES ===
void System_Init(char *Commandline);
@@
-22,6
+23,7
@@
void System_ExecuteCommandLine(void);
void System_ParseVFS(char *Arg);
void System_ParseModuleArgs(char *Arg);
void System_ParseSetting(char *Arg);
void System_ParseVFS(char *Arg);
void System_ParseModuleArgs(char *Arg);
void System_ParseSetting(char *Arg);
+void System_EmergencyConsole(void);
// === GLOBALS ===
const char *gsInitBinary = "/Acess/SBin/init";
// === GLOBALS ===
const char *gsInitBinary = "/Acess/SBin/init";
@@
-41,6
+43,7
@@
void System_Init(char *CommandLine)
Modules_LoadBuiltins();
Arch_LoadBootModules();
Modules_LoadBuiltins();
Arch_LoadBootModules();
+ Log_Log("Config", "Running command line '%s", CommandLine);
System_ExecuteCommandLine();
// - Execute the Config Script
System_ExecuteCommandLine();
// - Execute the Config Script
@@
-52,12
+55,24
@@
void System_Init(char *CommandLine)
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);
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);
+
+ System_EmergencyConsole();
+
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/pts/vt7");
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/pts/vt7");
+
+ // Run a thread to reap unowned threads
+ for( ;; )
+ {
+ int status;
+ // TODO: Inform init when a thread dies
+ int tid = Threads_WaitTID(-1, &status);
+ Log_Debug("Thread0", "Thread %i exited with status %i", tid, status);
+ }
}
/**
}
/**
@@
-78,7
+93,10
@@
void System_ParseCommandLine(char *ArgString)
// Eat Whitespace
while(*str == ' ') str++;
// Check for the end of the string
// Eat Whitespace
while(*str == ' ') str++;
// Check for the end of the string
- if(*str == '\0') { argc--; break;}
+ if(*str == '\0') {
+ argc--;
+ break;
+ }
argv[argc] = str;
if(*str == '"') {
while(*str && !(*str == '"' && str[-1] != '\\'))
argv[argc] = str;
if(*str == '"') {
while(*str && !(*str == '"' && str[-1] != '\\'))
@@
-262,3
+280,8
@@
void System_ParseSetting(char *Arg)
}
}
}
}
+void System_EmergencyConsole(void)
+{
+ // TODO: Support an emergency kernel-land console (with FS viewing support)
+ EmergencyConsole();
+}
UCC
git Repository :: git.ucc.asn.au