kprintf

kprintf - #include #include #include #include #include...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <types.h> #include <stdarg.h> #include <kern/unistd.h> #include <lib.h> #include <synch.h> #include <vfs.h> // for vfs_sync() #include <thread.h> // for thread_panic(); #include <machine/pcb.h> // for md_panic() #include <machine/spl.h> /* Flags word for DEBUG() macro. */ u_int32_t dbflags = 0; /* Lock for non-polled kprintfs */ static struct lock *kprintf_lock; /* * Warning: all this has to work from interrupt handlers and when * interrupts are disabled. */ /* Send characters to the console. */ static void console_send(void *junk, const char *data, size_t len) { size_t i; (void)junk; for (i=0; i<len; i++) { putch(data[i]); } } /* Create the kprintf lock. Must be called before creating a second thread. */ void kprintf_bootstrap(void) { assert(kprintf_lock == NULL); kprintf_lock = lock_create("kprintf_lock"); if (kprintf_lock == NULL) { panic("Could not create kprintf lock\n"); } } /* Printf to the console. */ int kprintf(const char *fmt, . ..) { int chars; va_list ap; lock_acquire(kprintf_lock); }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/10/2009 for the course CS 536 taught by Professor Lums during the Spring '09 term at Indiana.

Page1 / 3

kprintf - #include #include #include #include #include...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online