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);
77 for (y = -LOG_ONSCREEN; y < 0; y++)
78 strblit(logents[(y + prodptr + LOGLEN) % LOGLEN], y + LOG_ONSCREEN, 40, 1);
82 void dolog(const char *s)
84 strcpy(logents[prodptr], s);
85 prodptr = (prodptr + 1) % LOGLEN;
93 void (*output)(const char *s) = dolog;
95 void dologf(const char *fmt, ...)
101 vsnprintf(logents[prodptr], 40, fmt, va);
102 s = logents[prodptr];
108 prodptr = (prodptr + 1) % LOGLEN;
112 void (*outputf)(const char *s, ...) = dologf;
114 void dump_log (char * target) {
115 memcpy(target, logents, sizeof(logents));