Fixed the serial port bug that caused a FIFO overflow in Bochs.

This commit is contained in:
2020-06-19 13:49:10 -05:00
parent 84f64badaf
commit 4c4054451c
3 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
#ifndef KERNEL_VERSION_NUMBER #ifndef KERNEL_VERSION_NUMBER
#define KERNEL_VERSION_NUMBER "0.0.1-348" #define KERNEL_VERSION_NUMBER "0.0.1-354"
#endif #endif
+5 -3
View File
@@ -7,11 +7,11 @@ void kmain()
{ {
set_serial_baud_rate(COM1_PORT, 0x03); set_serial_baud_rate(COM1_PORT, 0x03);
configure_serial_line(COM1_PORT); configure_serial_line(COM1_PORT);
write_to_com(COM1_PORT, "Info From Kernel: Set up COM1 for messaging.\n"); write_to_com(COM1_PORT, "Set up COM1 for messaging.\n");
clear_screen(); clear_screen();
write_to_com(COM1_PORT, "Info From Kernel: Clearing screen.\n"); write_to_com(COM1_PORT, "Clearing screen.\n");
print_banner(); print_banner();
write_to_com(COM1_PORT, "Info From Kernel: Displaying OS banner.\n"); write_to_com(COM1_PORT, "Displaying OS banner.\n");
//draw_rect(20, 5, 50, 7, 0x4, 0xF); //draw_rect(20, 5, 50, 7, 0x4, 0xF);
draw_rect(0, 5, 5, 13, 0xF, 0x4); draw_rect(0, 5, 5, 13, 0xF, 0x4);
draw_rect(5, 8, 10, 10, 0x4, 0xF); draw_rect(5, 8, 10, 10, 0x4, 0xF);
@@ -37,8 +37,10 @@ void kmain()
//draw_s("And 2nd Row. Now the 3rd row.", 2, 9); //draw_s("And 2nd Row. Now the 3rd row.", 2, 9);
move_cursor(0, 3); move_cursor(0, 3);
draw_string("Installing GDT...\n", 0xF, 0x0); draw_string("Installing GDT...\n", 0xF, 0x0);
write_to_com(COM1_PORT, "Installing the GDT.\n");
gdt_install(); gdt_install();
move_cursor(0, 4); move_cursor(0, 4);
write_to_com(COM1_PORT, "GDT installed.\n");
draw_string("Installed GDT\n", 0xf, 0x0); draw_string("Installed GDT\n", 0xf, 0x0);
asm("hlt"); asm("hlt");
+1 -1
View File
@@ -47,7 +47,7 @@ void configure_serial_line(unsigned short com){
*/ */
int serial_transmit_fifo_empty(unsigned int com){ int serial_transmit_fifo_empty(unsigned int com){
// 0x20 = 0010 0000 // 0x20 = 0010 0000
return inb((com + 5) & 0x20); return inb(com + 5) & 0x20;
} }
void write_to_com(unsigned int com, char* msg){ void write_to_com(unsigned int com, char* msg){