diff options
Diffstat (limited to 'kern/printf.c')
-rw-r--r-- | kern/printf.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/kern/printf.c b/kern/printf.c index f657fdfc..68cf4ba9 100644 --- a/kern/printf.c +++ b/kern/printf.c @@ -15,10 +15,11 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <stdio.h> - #include <kern/console.h> +#include <kern/fmt.h> +#include <kern/init.h> #include <kern/spinlock.h> +#include <machine/boot.h> #include <machine/cpu.h> /* @@ -51,7 +52,7 @@ vprintf(const char *format, va_list ap) spinlock_lock_intr_save(&printf_lock, &flags); - length = vsnprintf(printf_buffer, sizeof(printf_buffer), format, ap); + length = fmt_vsnprintf(printf_buffer, sizeof(printf_buffer), format, ap); for (ptr = printf_buffer; *ptr != '\0'; ptr++) { console_putchar(*ptr); @@ -62,8 +63,14 @@ vprintf(const char *format, va_list ap) return length; } -void +static int __init printf_setup(void) { spinlock_init(&printf_lock); + return 0; } + +INIT_OP_DEFINE(printf_setup, + INIT_OP_DEP(boot_bootstrap_console, true), + INIT_OP_DEP(console_bootstrap, true), + INIT_OP_DEP(spinlock_setup, true)); |