3 #include <video_defines.h>
10 #define LOG_ONSCREEN 4
12 static char logents[LOGLEN][41] = {{0}};
13 static int prodptr = 0;
14 static int flush_imm = 0;
16 #define VRAM_BASE 0xA0000UL
17 #define TEXT_CONSOLE_OFFSET 0x18000UL
19 #define TEXT_CONSOLE_BASE (VRAM_BASE + TEXT_CONSOLE_OFFSET)
23 void vga_flush_imm(int imm)
28 static unsigned char vga_read(unsigned char idx)
30 outb(CRTC_IDX_REG, idx);
31 return inb(CRTC_DATA_REG);
34 static char * vga_base()
38 + (((unsigned int) vga_read(CRTC_START_ADDR_MSB_IDX)) << 9)
39 + (((unsigned int) vga_read(CRTC_START_ADDR_LSB_IDX)) << 1)
43 void strblit(char *src, int row, int col, int fill)
45 char *destp = vga_base() + row * 80 * 2 + col * 2;
47 smram_state_t old_state = smram_save_state();
50 smram_aseg_set_state(SMRAM_ASEG_SMMCODE);
55 *(destp++) = *(src++);
68 smram_restore_state(old_state);
76 for (y = -LOG_ONSCREEN; y < 0; y++)
77 strblit(logents[(y + prodptr + LOGLEN) % LOGLEN], y + LOG_ONSCREEN, 40, 1);
80 void dolog(const char *s)
82 strcpy(logents[prodptr], s);
83 prodptr = (prodptr + 1) % LOGLEN;
91 void (*output)(const char *s) = dolog;
93 void dologf(const char *fmt, ...)
99 vsnprintf(logents[prodptr], 40, fmt, va);
100 s = logents[prodptr];
106 prodptr = (prodptr + 1) % LOGLEN;
110 void (*outputf)(const char *s, ...) = dologf;
112 void dump_log (char * target) {
113 memcpy(target, logents, sizeof(logents));