2023-03-13 15:32:46 +02:00
|
|
|
#include <BAN/Formatter.h>
|
|
|
|
#include <kernel/Syscall.h>
|
|
|
|
|
2023-04-12 17:51:36 +03:00
|
|
|
#include <unistd.h>
|
2023-03-13 15:32:46 +02:00
|
|
|
|
2023-04-12 17:51:36 +03:00
|
|
|
#define USERSPACE __attribute__((section(".userspace")))
|
2023-03-13 15:32:46 +02:00
|
|
|
|
|
|
|
USERSPACE void userspace_entry()
|
|
|
|
{
|
2023-04-12 17:51:36 +03:00
|
|
|
Kernel::syscall(SYS_WRITE, STDOUT_FILENO, "Hello World!", 12);
|
2023-04-21 10:40:24 +03:00
|
|
|
|
|
|
|
char buffer[128];
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
long n_read = Kernel::syscall(SYS_READ, STDIN_FILENO, buffer, sizeof(buffer));
|
|
|
|
Kernel::syscall(SYS_WRITE, STDOUT_FILENO, buffer, n_read);
|
|
|
|
}
|
|
|
|
|
2023-04-12 17:51:36 +03:00
|
|
|
Kernel::syscall(SYS_EXIT);
|
2023-03-13 15:32:46 +02:00
|
|
|
}
|