use the -newos toolchain even if -elf is present.
[newos.git] / boot / ppc / stage2_of.c
blob8536587744e524bf2d0c20354cbb54b6abfae0fe
1 /*
2 ** Copyright 2001-2004, Travis Geiselbrecht. All rights reserved.
3 ** Distributed under the terms of the NewOS License.
4 */
5 #include <boot/stage2.h>
6 #include <boot/shared/openfirmware.h>
7 #include "stage2_priv.h"
8 #include <stdarg.h>
9 #include <stdio.h>
11 static int of_input_handle = 0;
12 static int of_output_handle = 0;
14 int of_console_init(void)
16 int chosen;
18 /* open the input and output handle */
19 chosen = of_finddevice("/chosen");
20 of_getprop(chosen, "stdin", &of_input_handle, sizeof(of_input_handle));
21 of_getprop(chosen, "stdout", &of_output_handle, sizeof(of_output_handle));
23 return 0;
26 #if 1
27 int printf(const char *fmt, ...)
29 int ret;
30 va_list args;
31 char temp[256];
33 va_start(args, fmt);
34 ret = vsprintf(temp,fmt,args);
35 va_end(args);
37 puts(temp);
38 return ret;
41 void puts(char *str)
43 while(*str) {
44 if(*str == '\n')
45 putchar('\r');
46 putchar(*str);
47 str++;
51 void putchar(char c)
53 if(of_output_handle != 0)
54 of_write(of_output_handle, &c, 1);
56 #endif