Fixes a nit:

put a spinlock around the serial debug routines to keep multiple
cpus from interleaving their output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19548 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Travis Geiselbrecht 2006-12-18 07:23:39 +00:00
parent 10f6ed940b
commit 9bc7a58b1d
1 changed files with 22 additions and 3 deletions

View File

@ -97,6 +97,7 @@ static bool sKeyboardHandlerInstalled = false;
static bool sBochsOutput = false;
#endif
static spinlock sSerialOutputSpinlock = 0;
static void
put_char(const char c)
@ -280,8 +281,8 @@ arch_debug_serial_getchar(void)
}
void
arch_debug_serial_putchar(const char c)
static void
_arch_debug_serial_putchar(const char c)
{
if (c == '\n') {
put_char('\r');
@ -290,14 +291,32 @@ arch_debug_serial_putchar(const char c)
put_char(c);
}
void
arch_debug_serial_putchar(const char c)
{
cpu_status state = disable_interrupts();
acquire_spinlock(&sSerialOutputSpinlock);
_arch_debug_serial_putchar(c);
release_spinlock(&sSerialOutputSpinlock);
restore_interrupts(state);
}
void
arch_debug_serial_puts(const char *s)
{
cpu_status state = disable_interrupts();
acquire_spinlock(&sSerialOutputSpinlock);
while (*s != '\0') {
arch_debug_serial_putchar(*s);
_arch_debug_serial_putchar(*s);
s++;
}
release_spinlock(&sSerialOutputSpinlock);
restore_interrupts(state);
}