Terminal lock

This commit is contained in:
2025-09-07 22:23:41 +02:00
parent 80a788617e
commit 659f98910d
3 changed files with 4 additions and 0 deletions

View File

@ -7,7 +7,9 @@
#define kprintf(fmt, ...) \ #define kprintf(fmt, ...) \
do { \ do { \
spinlock_acquire(&TERM.spinlock); \
printf_(fmt, ##__VA_ARGS__); \ printf_(fmt, ##__VA_ARGS__); \
spinlock_release(&TERM.spinlock); \
} while(0) } while(0)
#define ksprintf sprintf_ #define ksprintf sprintf_

View File

@ -32,6 +32,7 @@ void term_doinit(void *addr) {
void term_init(void *addr) { void term_init(void *addr) {
term_doinit(addr); term_doinit(addr);
spinlock_init(&TERM.spinlock);
} }
void term_write_unsafe(const char *s, size_t len) { void term_write_unsafe(const char *s, size_t len) {

View File

@ -7,6 +7,7 @@
typedef struct { typedef struct {
struct flanterm_context *ftctx; struct flanterm_context *ftctx;
SpinLock spinlock;
} Term; } Term;
extern Term TERM; extern Term TERM;