3 #include <video_defines.h>
11 static char logents[LOGLEN][41] = {{0}};
12 static int prodptr = 0;
13 static int flush_imm = 0;
15 #define VRAM_BASE 0xA0000UL
16 #define TEXT_CONSOLE_OFFSET 0x18000UL
18 #define TEXT_CONSOLE_BASE (VRAM_BASE + TEXT_CONSOLE_OFFSET)
22 void vga_flush_imm(int imm)
27 static unsigned char vga_read(unsigned char idx)
29 outb(CRTC_IDX_REG, idx);
30 return inb(CRTC_DATA_REG);
33 static char * vga_base()
37 + (((unsigned int) vga_read(CRTC_START_ADDR_MSB_IDX)) << 9)
38 + (((unsigned int) vga_read(CRTC_START_ADDR_LSB_IDX)) << 1)
42 void strblit(char *src, int row, int col)
44 char *destp = vga_base() + row * 80 * 2 + col * 2;
46 smram_state_t old_state = smram_save_state();
49 smram_aseg_set_state(SMRAM_ASEG_SMMCODE);
54 *(destp++) = *(src++);
59 smram_restore_state(old_state);
66 char *basep = vga_base();
68 smram_state_t old_state = smram_save_state();
70 smram_aseg_set_state(SMRAM_ASEG_SMMCODE);
72 for (y = 0; y < LOG_ONSCREEN; y++)
73 for (x = 40; x < 80; x++)
75 basep[y*80*2+x*2] = ' ';
76 basep[y*80*2+x*2+1] = 0x1F;
79 smram_restore_state(old_state);
81 for (y = -LOG_ONSCREEN; y < 0; y++)
82 strblit(logents[(y + prodptr) % LOGLEN], y + LOG_ONSCREEN, 40);
85 void dolog(const char *s)
87 strcpy(logents[prodptr], s);
88 prodptr = (prodptr + 1) % LOGLEN;
92 void (*output)(const char *s) = dolog;
94 void dologf(const char *fmt, ...)
97 void (*outputf)(const char *s, ...) = dologf;
99 void dump_log (char * target) {
100 memcpy(target, logents, sizeof(logents));