summaryrefslogtreecommitdiffstats
path: root/arch/x86/boot/tty.c
blob: 620197c677013a02d016d695aa41a51bf21b42b4 (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
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: 1991,1992 Linus Torvalds
// SPDX-FileCopyrightText: 2007 rPath, Inc.
// SPDX-FileCopyrightText: 2009 Intel Corporation

/* Author: H. Peter Anvin and others */

/**
 * @file
 * @brief Very simple screen I/O for the initialization stage
 *
 * @todo Probably should add very simple serial I/O?
 * @attention This is real mode code!
 */

#include <asm/segment.h>
#include "boot.h"

/* be aware of: */
THIS_IS_REALMODE_CODE

static void __bootcode putchar(int ch)
{
	struct biosregs ireg;

	if (ch == '\n')
		putchar('\r');	/* \n -> \r\n */

	initregs(&ireg);
	ireg.bx = 0x0007;
	ireg.cx = 0x0001;
	ireg.ah = 0x0e;
	ireg.al = ch;
	intcall(0x10, &ireg, NULL);
}

void __bootcode boot_puts(char *str)
{
	while (*str)
		putchar(*str++);
}