First Hello world syscall
All checks were successful
Build documentation / build-and-deploy (push) Successful in 26s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 26s
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
/// Lock, which ensures that prints to the serial port are atomic
|
||||
static spin_lock_t serial_lock = SPIN_LOCK_INIT;
|
||||
|
||||
static bool debug_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);
|
||||
@@ -30,6 +32,9 @@ static void amd64_debug_serial_write (char x) {
|
||||
* all prints are atomic.
|
||||
*/
|
||||
void debugprintf (const char* fmt, ...) {
|
||||
if (!debug_init)
|
||||
return;
|
||||
|
||||
char buffer[BUFFER_SIZE];
|
||||
memset (buffer, 0, sizeof (buffer));
|
||||
|
||||
@@ -61,4 +66,6 @@ void amd64_debug_init (void) {
|
||||
amd64_io_outb (PORT_COM1 + 3, 0x03);
|
||||
amd64_io_outb (PORT_COM1 + 2, 0xC7);
|
||||
amd64_io_outb (PORT_COM1 + 4, 0x0B);
|
||||
|
||||
debug_init = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user