static void blue_screen_cons(const char* message) { char seq[] = { CONS_ESCAPE, CONS_COLOR, CONS_BACK(CONS_BLUE) | CONS_FRONT(CONS_WHITE) | CONS_LIGHT, CONS_ESCAPE, CONS_CLEAR }; char fatal[] = { CONS_ESCAPE, CONS_SETX, 32, CONS_ESCAPE, CONS_SETY, 10, CONS_ESCAPE, CONS_COLOR, CONS_BACK(CONS_WHITE) | CONS_FRONT(CONS_BLUE) }; char msg[] = { CONS_ESCAPE, CONS_SETX, 0, CONS_ESCAPE, CONS_SETY, 13, CONS_ESCAPE, CONS_COLOR, CONS_BACK(CONS_BLUE) | CONS_FRONT(CONS_WHITE) | CONS_LIGHT }; char* chiche1 = "If this is not the first time you encounter"; char* chiche2 = "this problem, please contact [email protected]"; write (seq, sizeof (seq) / sizeof (char)); write (fatal, sizeof (fatal) / sizeof (char)); printf ("K -- FATAL ERROR", fatal); msg[2] = 40 - strlen (message) / 2; write (msg, sizeof (msg) / sizeof (char)); printf ("%s", message); msg[2] = 40 - strlen (chiche1) / 2; msg[5] += 2; write (msg, sizeof (msg) / sizeof (char)); printf ("%s", chiche1); msg[2] = 40 - strlen (chiche2) / 2; msg[5]++; write (msg, sizeof (msg) / sizeof (char)); printf ("%s", chiche2); while (1) ; }
int cons_init(void) { i_region reg; t_uint16 line; t_uint16 c; int br; if (region_reserve(__as_id, 0x1000, CONS_ADDR - 0x1000, REGION_OPT_NONE, 0, PAGESZ, ®) != ERROR_NONE) return (-1); cons.attr = CONS_FRONT(CONS_WHITE) | CONS_BACK(CONS_BLACK) | CONS_INT; cons.vga = (char*)(t_vaddr)reg; cons.line = 0; cons.column = 0; /* XXX[needless with the serial kernel redirection since we've got the whole screen for ourselves] for (br = 1, line = CONS_LINES - 1; br && line > 0; line--) { for (c = 0; c < CONS_COLUMNS * CONS_BPC; c += CONS_BPC) if (cons.vga[line * CONS_COLUMNS * CONS_BPC + c * CONS_BPC]) { br = 0; break; } } if (line == CONS_LINES - 1) { cons_scroll(1); cons.line = line; } else cons.line = line + 1; */ cons_clear(); return (0); }
static void set_attr(const int back, const int front) { text_attr = CONS_BACK(back) + CONS_FRONT(front); }