build: add a "user" arch to allow the kernel to run as a program on the host machine

This commit is contained in:
2023-02-25 17:58:23 +00:00
parent 8c87e78797
commit eed73e2414
21 changed files with 286 additions and 26 deletions

27
arch/user/stdcon.c Normal file
View File

@@ -0,0 +1,27 @@
#include <socks/libc/string.h>
#include <socks/libc/ctype.h>
#include <stdint.h>
#include <stdio.h>
#include <socks/console.h>
#include <socks/vm.h>
#include <socks/printk.h>
static void stdcon_write(console_t *con, const char *s, unsigned int len)
{
for (unsigned int i = 0; i < len; i++) {
fputc(s[i], stdout);
}
}
static console_t stdcon = {
.c_name = "stdcon",
.c_flags = CON_BOOT,
.c_write = stdcon_write,
.c_lock = SPIN_LOCK_INIT,
};
void stdcon_init(void)
{
console_register(&stdcon);
early_printk_init(&stdcon);
}