/** * Handler per i fault */ void fault_handler(regs_t *r) { if (r->which_int < 32) { video_puts("Error! '"); video_puts(exception_messages[r->which_int]); video_puts("' System Halted!\n"); for (;;); } }
void video_test1() { static long k; static long i = 0; i = 0; video_puts("I'm One abc\n"); while (1) { for (k = 0 ; k < 65000000 ; k ++); video_puts("abc\n"); } }
void video_test2() { long k; extern void test(); video_puts("I'm Two abc\n"); while (1) { /* video_set_6845(G_VID_ORG, scrolltop); scrolltop += 80; */ video_puts("--------------------------\n"); for (k = 0 ; k < 65000000 ; k ++); } }
void printk(char *fmt, ...) { va_list list; char buf[512]; va_start(list, fmt); vsnprintf(buf, sizeof(buf), fmt, list); video_puts(buf); va_end(list); }
/******************************************************************************* * Function Name : video_puthex * Description : This function prints a byte as hex * Input : Byte * Output : None * Return : None *******************************************************************************/ void video_puthex(u8 n) { static char hexchars[] = "0123456789ABCDEF"; char hexstr[5]; hexstr[0] = hexchars[(n >> 4) & 0xF]; hexstr[1] = hexchars[n & 0xF]; hexstr[2] = '\r'; hexstr[3] = '\n'; hexstr[4] = '\0'; video_puts(hexstr); }
static void dump_console_ring_key(unsigned char key) { uint32_t idx, len, sofar, c; unsigned int order; char *buf; printk("'%c' pressed -> dumping console ring buffer (dmesg)\n", key); /* create a buffer in which we'll copy the ring in the correct order and NUL terminate */ order = get_order_from_bytes(conring_size + 1); buf = alloc_xenheap_pages(order, 0); if ( buf == NULL ) { printk("unable to allocate memory!\n"); return; } c = conringc; sofar = 0; while ( (c != conringp) ) { idx = CONRING_IDX_MASK(c); len = conringp - c; if ( (idx + len) > conring_size ) len = conring_size - idx; memcpy(buf + sofar, &conring[idx], len); sofar += len; c += len; } buf[sofar] = '\0'; sercon_puts(buf); video_puts(buf); free_xenheap_pages(buf, order); }