summaryrefslogtreecommitdiffstats
path: root/src/roms/openbios/arch/ppc/qemu/qemu.c
blob: 381affb7722cdff6340dde0eb6e48e43602de606 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
 *   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 "config.h"
#include "kernel/kernel.h"
#include "arch/common/nvram.h"
#include "libopenbios/bindings.h"
#include "drivers/drivers.h"
#include "libc/vsprintf.h"
#include "libc/string.h"
#include "libc/byteorder.h"
#include "qemu/qemu.h"
#include <stdarg.h>

//#define DUMP_NVRAM

unsigned long virt_offset = 0;

void
exit( int status __attribute__ ((unused)))
{
	for (;;);
}

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, ... )
{
        char *p, buf[1024];
	va_list args;
	int i;

	va_start(args, fmt);
        i = vsnprintf(buf, sizeof(buf), fmt, args);
	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;
}

int arch_nvram_size(void)
{
    if (is_apple()) {
        return macio_get_nvram_size();
    } else {
        // not implemented
    }
    return 0;
}

void arch_nvram_put(char *buf)
{
    if (is_apple()) {
        macio_nvram_put(buf);
    } else {
        // not implemented
    }
}

void arch_nvram_get(char *buf)
{
    if (is_apple()) {
        macio_nvram_get(buf);
    } else {
        // not implemented
    }
}
OpenPOWER on IntegriCloud