2023-01-11 22:01:47 +00:00
|
|
|
#include <errno.h>
|
2023-01-06 12:31:14 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2023-01-11 22:01:47 +00:00
|
|
|
#include <string.h>
|
2023-01-13 18:08:02 +00:00
|
|
|
#include <sys/mman.h>
|
2023-01-06 23:21:08 +00:00
|
|
|
#include <time.h>
|
2023-01-06 12:31:14 +00:00
|
|
|
|
2023-01-06 18:40:25 +00:00
|
|
|
void bye()
|
|
|
|
{
|
2023-01-07 00:49:26 +00:00
|
|
|
printf("byeee!\n");
|
2023-01-06 18:40:25 +00:00
|
|
|
}
|
|
|
|
|
2023-01-06 12:31:14 +00:00
|
|
|
int main()
|
|
|
|
{
|
2023-01-06 18:40:25 +00:00
|
|
|
atexit(bye);
|
2023-01-07 00:49:26 +00:00
|
|
|
printf("Welcome to %s!\n", "Luna");
|
2023-01-06 19:15:43 +00:00
|
|
|
|
2023-01-06 23:27:23 +00:00
|
|
|
time_t now = time(NULL);
|
2023-01-07 00:49:26 +00:00
|
|
|
printf("Realtime clock: %ld s\n", now);
|
2023-01-06 23:21:08 +00:00
|
|
|
|
2023-01-07 00:49:26 +00:00
|
|
|
for (int i = 0; i < atoi("8"); i++) { console_write(".", 1); }
|
2023-01-06 12:31:14 +00:00
|
|
|
|
2023-01-07 00:49:26 +00:00
|
|
|
console_write("\n", 1);
|
2023-01-11 22:01:47 +00:00
|
|
|
|
2023-01-13 18:08:02 +00:00
|
|
|
char* address = (char*)allocate_memory(PAGE_SIZE * 2, PROT_READ | PROT_WRITE);
|
2023-01-11 22:01:47 +00:00
|
|
|
printf("address: %p\n", address);
|
|
|
|
printf("memory at address: %c\n", *address);
|
|
|
|
*address = 'e';
|
|
|
|
printf("memory at address: %c\n", *address);
|
|
|
|
|
2023-01-13 18:08:02 +00:00
|
|
|
deallocate_memory(address, PAGE_SIZE * 2);
|
2023-01-06 12:31:14 +00:00
|
|
|
}
|