Fix PMM for real HW + serial lock

This commit is contained in:
2026-03-19 16:54:23 +01:00
parent b77c53ae99
commit 6a82d581fb
9 changed files with 52 additions and 45 deletions

View File

@@ -6,9 +6,13 @@
#include <kernel.h>
#include <io/serial/serial.h>
#include <sched/spinlock.h>
extern struct init_status init;
extern int panic_count;
struct spinlock_t serial_lock = {0};
/*
* outb - Writes a byte to a CPU port
* @port: CPU port to write to
@@ -85,9 +89,15 @@ static int is_transmit_empty()
*/
void skputc(char c)
{
// TODO: Spinlock here (serial access)
while (!is_transmit_empty()); // wait for free spot
outb(PORT, c);
if (panic_count == 0) {
spinlock_acquire(&serial_lock);
while (!is_transmit_empty()); // wait for free spot
outb(PORT, c);
spinlock_release(&serial_lock);
} else {
while (!is_transmit_empty());
outb(PORT, c);
}
}
/*

View File

@@ -113,7 +113,7 @@ extern struct flanterm_context* ft_ctx;
extern struct boot_context boot_ctx;
/*
* flanterm_free_wrapper - free() wrapper for Flanterm
* flanterm_free_wrapper - free() wrapper for Flanterm (DEPRECATED)
* @ptr: pointer to free
* @size: amount of bytes to free
*