[Add] laos base boot

This commit is contained in:
bLueriVerLHR
2023-05-21 00:48:04 +08:00
parent 5d31bf294c
commit 029a8823f4
34 changed files with 927 additions and 18 deletions

28
laos/src/kernel/console.c Normal file
View File

@@ -0,0 +1,28 @@
#include "console.h"
#include "memio.h"
#include "memlayout.h"
#include "spinlock.h"
void consputc(int c) {
if (c == '\b') {
memb(SERIAL_ADDR) = '\b';
memb(SERIAL_ADDR) = ' ';
memb(SERIAL_ADDR) = '\b';
return;
}
memb(SERIAL_ADDR) = c;
}
struct {
struct spinlock lock;
// input
#define INPUT_BUF_SIZE 128
char buf[INPUT_BUF_SIZE];
uint r; // Read index
uint w; // Write index
uint e; // Edit index
} cons;