2022-10-02 18:10:53 +02:00
|
|
|
#include <luna.h>
|
2022-10-03 19:00:10 +02:00
|
|
|
#include <stdio.h>
|
2022-10-02 17:25:56 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/syscall.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2022-10-02 18:16:27 +02:00
|
|
|
__luna_abort("SHENANIGANS! init is tid 0 (which is reserved for the idle task)\n");
|
2022-10-02 17:25:56 +02:00
|
|
|
}
|
|
|
|
|
2022-10-03 19:00:10 +02:00
|
|
|
printf("Welcome to Luna!\n");
|
2022-10-02 17:25:56 +02:00
|
|
|
|
2022-10-03 19:00:10 +02:00
|
|
|
printf("Running as tid %ld\n\n", gettid());
|
2022-10-02 17:25:56 +02:00
|
|
|
|
2022-10-03 19:00:10 +02:00
|
|
|
sleep(1);
|
2022-10-02 17:25:56 +02:00
|
|
|
|
|
|
|
char version[40];
|
|
|
|
syscall(SYS_getversion, version, sizeof(version));
|
|
|
|
|
2022-10-03 19:00:10 +02:00
|
|
|
printf("Your kernel version is %s\n\n", version);
|
2022-10-02 17:25:56 +02:00
|
|
|
|
2022-10-02 18:10:53 +02:00
|
|
|
sleep(2);
|
2022-10-02 17:25:56 +02:00
|
|
|
|
2022-10-02 20:45:04 +02:00
|
|
|
{
|
|
|
|
char* variable = malloc(200);
|
|
|
|
*variable = 3;
|
2022-10-03 19:00:10 +02:00
|
|
|
printf("Allocated variable at address %lx\n", (unsigned long int)variable);
|
2022-10-02 20:45:04 +02:00
|
|
|
free(variable);
|
|
|
|
}
|
|
|
|
|
2022-10-03 19:00:10 +02:00
|
|
|
printf("Press any key to restart.\n");
|
2022-10-02 17:25:56 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|