From d3c91c004826b57832bbe8a2066f9d6f51bad46d Mon Sep 17 00:00:00 2001 From: Edgaru089 Date: Fri, 5 Nov 2021 15:11:58 +0800 Subject: [PATCH] driver/serial: disable interrupt when writing to serial --- driver/irq/pic/serial/serial.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/driver/irq/pic/serial/serial.c b/driver/irq/pic/serial/serial.c index 2f9e399..fec1847 100644 --- a/driver/irq/pic/serial/serial.c +++ b/driver/irq/pic/serial/serial.c @@ -39,6 +39,7 @@ bool pic_serial_Init(pic_serial_Port *port, int baudrate, int lineFlags) { void pic_serial_Write(pic_serial_Port *port, const char *str, int n) { if (port && port->ok) { + INTERRUPT_DISABLE; if (n != 0) { for (int i = 0; i < n; i++) { while ((inb(port->port + 5) & 0x20) == 0) {} @@ -51,5 +52,6 @@ void pic_serial_Write(pic_serial_Port *port, const char *str, int n) { str++; } } + INTERRUPT_RESTORE; } }