X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flib%2Fkernel%2Fconsole.c;h=149f29c7eb46f07e12c6af8744d8669e25b0340c;hb=76f6e5dbcd612bbf79e0243bb8a0247b52043571;hp=803b46b393dca80c9773e165bdcf8715c2a67de5;hpb=a495d508b3e7d4f0ddbfe60066064474d1898e0d;p=pintos-anon diff --git a/src/lib/kernel/console.c b/src/lib/kernel/console.c index 803b46b..149f29c 100644 --- a/src/lib/kernel/console.c +++ b/src/lib/kernel/console.c @@ -59,6 +59,20 @@ puts (const char *s) return 0; } +/* Writes the N characters in BUFFER to the console. */ +void +putbuf (const char *buffer, size_t n) +{ + if (!intr_context ()) + lock_acquire (&console_lock); + + while (n-- > 0) + putchar_unlocked (*buffer++); + + if (!intr_context ()) + lock_release (&console_lock); +} + /* Writes C to the vga display and serial port. */ int putchar (int c)