[update] os

This commit is contained in:
bLueriVerLHR
2023-06-26 09:56:22 +08:00
parent 75644e4920
commit c931384e30
10 changed files with 125 additions and 31 deletions

View File

@@ -2,27 +2,27 @@
#include "memio.h"
#include "memlayout.h"
#include "spinlock.h"
#include "dev.h"
void consputc(int c) {
if (c == '\b') {
memb(SERIAL_ADDR) = '\b';
memb(SERIAL_ADDR) = ' ';
memb(SERIAL_ADDR) = '\b';
return;
}
volatile char *out = &ioports[SERIAL_OFFSET];
if (c == '\b') {
*out = '\b';
*out = ' ';
*out = '\b';
return;
}
memb(SERIAL_ADDR) = c;
*out = 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
uint r; // Read index
uint w; // Write index
uint e; // Edit index
} cons;