dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / arch / x86 / kernel / promif / prom_putchar.c
blob1650fee6a16ea6ce07e68f789b3d453a817484cf
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include <sys/promif.h>
30 #include <sys/promimpl.h>
31 #include <sys/bootsvcs.h>
33 /*ARGSUSED*/
34 int
35 prom_mayput(char c)
37 prom_putchar(c);
38 return (1);
41 void
42 prom_putchar(char c)
44 static int bhcharpos = 0;
45 promif_owrap_t *ow;
47 ow = promif_preout();
48 switch (c) {
49 case '\t':
50 do {
51 BSVC_PUTCHAR(SYSP, ' ');
52 } while (++bhcharpos % 8);
53 break;
54 case '\n':
55 case '\r':
56 bhcharpos = 0;
57 BSVC_PUTCHAR(SYSP, c);
58 break;
59 case '\b':
60 if (bhcharpos)
61 bhcharpos--;
62 BSVC_PUTCHAR(SYSP, c);
63 break;
64 default:
65 bhcharpos++;
66 BSVC_PUTCHAR(SYSP, c);
67 break;
69 promif_postout(ow);
72 void
73 prom_writestr(const char *s, size_t n)
75 while (n-- != 0)
76 prom_putchar(*s++);