static u16_t* const vga_buffer = VGA_BUFFER_ADDR;
static u16_t vga_attrs = VGA_FONT(VGA_LIGHT_GRAY) | VGA_BACKGROUND(VGA_BLACK);
static i32_t vga_offset = VGA_BUFFER_SIZE;
+static int _early_printf_disable = 0;
#define VGA_SET_FONT(c) vga_attrs = (vga_attrs & 0xf0ff) | VGA_FONT(c)
#define VGA_SET_BACKGROUND(c) vga_attrs = (vga_attrs & 0x0fff) | VGA_BACKGROUND(c)
return;
}
+void dbg_printf_disable(void)
+{
+ _early_printf_disable = 1;
+ return;
+}
+
int dbg_printf(const char *format, ...)
{
int n;
int pad;
const char *fmt;
+ if(_early_printf_disable) {
+ return(-1);
+ }
+
#define MODE_NORMAL 0
#define MODE_CONV 1
#define FLAG_SIGN (1 << 31)
/* FIXME: Handle error */
}
+ #if 0
struct cxmsg msg;
char *hw = "Hello, world\n";
memcpy(msg.cm_data, hw, 13);
cxsendrecv(vgapid, &msg);
-
+ #endif
wait(NULL);
return;
PANIC("Could not spawn init process\n");
}
+ /*
+ * Disable early printf - all further output should
+ * be printed through the VGA process that is spawned
+ * by init.
+ */
+ dbg_printf_disable();
+
sched_tick();
dbg_printf("This should not get printed\n");
int dbg_printf(const char*, ...);
void dbg_panic(const char*, const char*, i32_t, const char*);
+void dbg_printf_disable(void);
#endif /* __DEBUG_H */