[kernel] Make stdout channel available to processes

The "fake" stdout channel is now being passed in the new j6_process_init
structure to processes, and nulldrv now uses it to print a message to
the console.
This commit is contained in:
2020-08-30 18:47:14 -07:00
parent 724b846ee4
commit 42455873ff
7 changed files with 58 additions and 10 deletions

View File

@@ -92,7 +92,13 @@ stdout_task()
}
buffer[n] = 0;
cons->puts(reinterpret_cast<const char *>(buffer));
const char *s = reinterpret_cast<const char *>(buffer);
while (n) {
size_t r = cons->puts(s);
n -= r + 1;
s += r + 1;
}
}
}
@@ -193,6 +199,8 @@ kernel_main(args::header *header)
syscall_enable();
scheduler *sched = new scheduler(devices.get_lapic());
std_out = new channel;
for (auto &ird : initrds) {
for (auto &f : ird.files()) {
if (f.executable()) {
@@ -203,8 +211,6 @@ kernel_main(args::header *header)
}
}
std_out = new channel;
sched->create_kernel_task(logger_task, scheduler::max_priority-1, true);
sched->create_kernel_task(stdout_task, scheduler::max_priority-1, true);