1 /* 2 * Copyright 2008-2010, François Revol, revol@free.fr. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7 #include "keyboard.h" 8 #include "nextrom.h" 9 10 #include <boot/stage2.h> 11 #include <boot/platform.h> 12 #include <boot/stdio.h> 13 #include <stdarg.h> 14 15 #include <Errors.h> 16 17 void mon_put(const char *s) 18 { 19 while (s && *s) 20 mg->mg_putc(*s++); 21 } 22 23 void mon_puts(const char *s) 24 { 25 mon_put(s); 26 mg->mg_putc('\n'); 27 } 28 29 /*! This works only after console_init() was called. 30 */ 31 void 32 panic(const char *format, ...) 33 { 34 const char greetings[] = "\n*** PANIC ***"; 35 char buffer[512]; 36 va_list list; 37 38 //platform_switch_to_text_mode(); 39 40 mon_puts(greetings); 41 42 va_start(list, format); 43 vsnprintf(buffer, sizeof(buffer), format, list); 44 va_end(list); 45 46 mon_puts(buffer); 47 48 mon_puts("\nPress key to reboot."); 49 50 clear_key_buffer(); 51 wait_for_key(); 52 platform_exit(); 53 } 54 55 56 void 57 dprintf(const char *format, ...) 58 { 59 char buffer[512]; 60 va_list list; 61 62 va_start(list, format); 63 vsnprintf(buffer, sizeof(buffer), format, list); 64 va_end(list); 65 66 //if (platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT) 67 if (!gKernelArgs.frame_buffer.enabled) 68 mon_put(buffer); 69 } 70 71 72 char* 73 platform_debug_get_log_buffer(size_t* _size) 74 { 75 return NULL; 76 } 77