2022-10-02 18:10:53 +02:00
|
|
|
#include <luna.h>
|
2022-10-02 17:25:56 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/syscall.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
static void print(const char* message)
|
|
|
|
{
|
|
|
|
syscall(SYS_write, message, strlen(message));
|
|
|
|
}
|
|
|
|
|
|
|
|
#define println(message) print(message "\n")
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2022-10-02 18:10:53 +02:00
|
|
|
if (gettid() == 0) // why are we the idle task?
|
2022-10-02 17:25:56 +02:00
|
|
|
{
|
|
|
|
println("SHENANIGANS! init is tid 0 (which is reserved for the idle task)");
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|
|
|
|
println("Welcome to Luna from a C init!");
|
|
|
|
println("");
|
|
|
|
|
2022-10-02 18:10:53 +02:00
|
|
|
sleep(1);
|
2022-10-02 17:25:56 +02:00
|
|
|
|
|
|
|
print("Your kernel version is ");
|
|
|
|
|
|
|
|
char version[40];
|
|
|
|
syscall(SYS_getversion, version, sizeof(version));
|
|
|
|
|
|
|
|
print(version);
|
|
|
|
println("\n");
|
|
|
|
|
2022-10-02 18:10:53 +02:00
|
|
|
sleep(2);
|
2022-10-02 17:25:56 +02:00
|
|
|
|
|
|
|
println("Press any key to restart.");
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|