X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdevices%2Fvga.c;h=949dd975eaec8da2ae0e34551b7ca23765a14792;hb=2e8d8e1e1d4aa9c90b78c6d40bc315dd4e5270b9;hp=bc2d6b72bd561321b16f2c8a877c397c4d7a2a26;hpb=f2f8875638593bd5365cfd6a5ba7c9578e52322f;p=pintos-anon diff --git a/src/devices/vga.c b/src/devices/vga.c index bc2d6b7..949dd97 100644 --- a/src/devices/vga.c +++ b/src/devices/vga.c @@ -4,7 +4,8 @@ #include #include #include "threads/io.h" -#include "threads/mmu.h" +#include "threads/interrupt.h" +#include "threads/vaddr.h" /* VGA text screen support. See [FREEVGA] for more information. */ @@ -38,10 +39,14 @@ vga_init (void) } /* Writes C to the VGA text display, interpreting control - characters in the conventional ways. */ + characters in the conventional ways. */ void vga_putc (int c) { + /* Disable interrupts to lock out interrupt handlers + that might write to the console. */ + enum intr_level old_level = intr_disable (); + switch (c) { case '\n': @@ -77,6 +82,8 @@ vga_putc (int c) /* Update cursor position. */ move_cursor (); + + intr_set_level (old_level); } /* Clears the screen and moves the cursor to the upper left. */