Remove amd64_ platform prefix

This commit is contained in:
2026-02-20 15:33:16 +01:00
parent 4472ad5bb3
commit c68b00f2ea
28 changed files with 236 additions and 246 deletions

View File

@@ -17,25 +17,23 @@
*/
static spin_lock_t serial_lock = SPIN_LOCK_INIT;
static bool debug_init = false;
static bool debug_is_init = false;
/* Block until TX buffer is empty */
static bool amd64_debug_serial_tx_empty (void) {
return (bool)(amd64_io_inb (PORT_COM1 + 5) & 0x20);
}
static bool debug_serial_tx_empty (void) { return (bool)(inb (PORT_COM1 + 5) & 0x20); }
/* Write a single character to serial */
static void amd64_debug_serial_write (char x) {
while (!amd64_debug_serial_tx_empty ())
static void debug_serial_write (char x) {
while (!debug_serial_tx_empty ())
;
amd64_io_outb (PORT_COM1, (uint8_t)x);
outb (PORT_COM1, (uint8_t)x);
}
/*
* Formatted printing to serial. serial_lock ensures that all prints are atomic.
*/
void debugprintf (const char* fmt, ...) {
if (!debug_init)
if (!debug_is_init)
return;
char buffer[BUFFER_SIZE];
@@ -53,7 +51,7 @@ void debugprintf (const char* fmt, ...) {
spin_lock (&serial_lock);
while (*p) {
amd64_debug_serial_write (*p);
debug_serial_write (*p);
p++;
}
@@ -61,14 +59,14 @@ void debugprintf (const char* fmt, ...) {
}
/* Initialize serial */
void amd64_debug_init (void) {
amd64_io_outb (PORT_COM1 + 1, 0x00);
amd64_io_outb (PORT_COM1 + 3, 0x80);
amd64_io_outb (PORT_COM1 + 0, 0x03);
amd64_io_outb (PORT_COM1 + 1, 0x00);
amd64_io_outb (PORT_COM1 + 3, 0x03);
amd64_io_outb (PORT_COM1 + 2, 0xC7);
amd64_io_outb (PORT_COM1 + 4, 0x0B);
void debug_init (void) {
outb (PORT_COM1 + 1, 0x00);
outb (PORT_COM1 + 3, 0x80);
outb (PORT_COM1 + 0, 0x03);
outb (PORT_COM1 + 1, 0x00);
outb (PORT_COM1 + 3, 0x03);
outb (PORT_COM1 + 2, 0xC7);
outb (PORT_COM1 + 4, 0x0B);
debug_init = true;
debug_is_init = true;
}