2008-11-24 12:16:22 +00:00
|
|
|
/*
|
|
|
|
|
* Creation Date: <2004/08/28 18:38:22 greg>
|
|
|
|
|
* Time-stamp: <2004/08/28 18:38:22 greg>
|
|
|
|
|
*
|
|
|
|
|
* <qemu.c>
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2004, Greg Watson
|
|
|
|
|
*
|
|
|
|
|
* derived from mol.c
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2003, 2004 Samuel Rydh (samuel@ibrium.se)
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* version 2
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "openbios/config.h"
|
|
|
|
|
#include "openbios/kernel.h"
|
|
|
|
|
#include "openbios/nvram.h"
|
2008-11-24 12:23:01 +00:00
|
|
|
#include "openbios/bindings.h"
|
2008-11-30 11:54:01 +00:00
|
|
|
#include "openbios/drivers.h"
|
2008-11-24 12:16:22 +00:00
|
|
|
#include "libc/vsprintf.h"
|
|
|
|
|
#include "libc/string.h"
|
2008-11-24 12:21:36 +00:00
|
|
|
#include "libc/byteorder.h"
|
2008-11-24 12:16:22 +00:00
|
|
|
#include "qemu/qemu.h"
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
2008-11-24 12:21:36 +00:00
|
|
|
//#define DUMP_NVRAM
|
2008-11-24 12:16:22 +00:00
|
|
|
|
|
|
|
|
void
|
2008-11-24 12:23:01 +00:00
|
|
|
exit( int status __attribute__ ((unused)))
|
2008-11-24 12:16:22 +00:00
|
|
|
{
|
|
|
|
|
for (;;);
|
2008-11-24 12:23:01 +00:00
|
|
|
} __attribute__ ((noreturn))
|
2008-11-24 12:16:22 +00:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
fatal_error( const char *err )
|
|
|
|
|
{
|
|
|
|
|
printk("Fatal error: %s\n", err );
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
panic( const char *err )
|
|
|
|
|
{
|
|
|
|
|
printk("Panic: %s\n", err );
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int do_indent;
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
printk( const char *fmt, ... )
|
|
|
|
|
{
|
2008-11-30 13:44:38 +00:00
|
|
|
char *p, buf[1024];
|
2008-11-24 12:16:22 +00:00
|
|
|
va_list args;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
va_start(args, fmt);
|
2008-11-30 13:44:38 +00:00
|
|
|
i = vsnprintf(buf, sizeof(buf), fmt, args);
|
2008-11-24 12:16:22 +00:00
|
|
|
va_end(args);
|
|
|
|
|
|
|
|
|
|
for( p=buf; *p; p++ ) {
|
|
|
|
|
if( *p == '\n' )
|
|
|
|
|
do_indent = 0;
|
|
|
|
|
if( do_indent++ == 1 ) {
|
|
|
|
|
putchar( '>' );
|
|
|
|
|
putchar( '>' );
|
|
|
|
|
putchar( ' ' );
|
|
|
|
|
}
|
|
|
|
|
putchar( *p );
|
|
|
|
|
}
|
|
|
|
|
return i;
|
|
|
|
|
}
|