3 #include <video_defines.h>
8 static char logents[4][41] = {{0}};
10 #define VRAM_BASE 0xA0000UL
11 #define TEXT_CONSOLE_OFFSET 0x18000UL
13 #define TEXT_CONSOLE_BASE (VRAM_BASE + TEXT_CONSOLE_OFFSET)
17 static unsigned char vga_read(unsigned char idx)
19 outb(CRTC_IDX_REG, idx);
20 return inb(CRTC_DATA_REG);
23 static char * vga_base()
27 + (((unsigned int) vga_read(CRTC_START_ADDR_MSB_IDX)) << 9)
28 + (((unsigned int) vga_read(CRTC_START_ADDR_LSB_IDX)) << 1)
32 void strblit(char *src, int row, int col)
34 char *destp = vga_base() + row * 80 * 2 + col * 2;
35 smram_state_t old_state = smram_save_state();
37 smram_aseg_set_state(SMRAM_ASEG_SMMCODE);
41 *(destp++) = *(src++);
45 smram_restore_state(old_state);
51 char *basep = vga_base();
53 smram_state_t old_state = smram_save_state();
55 smram_aseg_set_state(SMRAM_ASEG_SMMCODE);
57 for (y = 0; y < 4; y++)
58 for (x = 40; x < 80; x++)
60 basep[y*80*2+x*2] = ' ';
61 basep[y*80*2+x*2+1] = 0x1F;
64 smram_restore_state(old_state);
66 for (y = 0; y < 4; y++)
67 strblit(logents[y], y, 40);
70 void dolog(const char *s)
72 memmove(logents[0], logents[1], sizeof(logents[0])*3);
73 strcpy(logents[3], s);
75 void (*output)(const char *s) = dolog;
77 void dologf(const char *fmt, ...)
81 memmove(logents[0], logents[1], sizeof(logents[0])*3);
83 vsnprintf(logents[3], 40, fmt, va);
86 void (*outputf)(const char *s, ...) = dologf;
88 void dump_log (char * target) {
89 memcpy(target, logents, sizeof(logents));