add additional lock to synchronize the usage of the video card

This commit is contained in:
Stefan Lankes 2012-07-22 22:16:30 +02:00
parent 7f7dd4585f
commit a3313a9e19

View file

@ -36,6 +36,7 @@
#ifdef CONFIG_VGA
static uint32_t early_print = VGA_EARLY_PRINT;
static spinlock_irqsave_t vga_lock = SPINLOCK_IRQSAVE_INIT;
#elif defined(CONFIG_UART)
static uint32_t early_print = UART_EARLY_PRINT;
#else
@ -156,8 +157,11 @@ int kputchar(int c)
pos = atomic_int32_inc(&kmsg_counter);
kmessages[pos % KMSG_SIZE] = (unsigned char) c;
#ifdef CONFIG_VGA
if (early_print == VGA_EARLY_PRINT)
if (early_print == VGA_EARLY_PRINT) {
spinlock_irqsave_lock(&vga_lock);
vga_putchar(c);
spinlock_irqsave_unlock(&vga_lock);
}
#endif
#ifdef CONFIG_UART
if (early_print == UART_EARLY_PRINT)
@ -169,8 +173,12 @@ int kputchar(int c)
int kputs(const char *str)
{
int pos;
int i;
int pos, i;
#ifdef CONFIG_VGA
if (early_print == VGA_EARLY_PRINT)
spinlock_irqsave_lock(&vga_lock);
#endif
for(i=0; str[i] != '\0'; i++) {
pos = atomic_int32_inc(&kmsg_counter);
@ -185,6 +193,11 @@ int kputs(const char *str)
#endif
}
#ifdef CONFIG_VGA
if (early_print == VGA_EARLY_PRINT)
spinlock_irqsave_unlock(&vga_lock);
#endif
return i;
}