1 /* -*- linux-c -*- ------------------------------------------------------- *
3 * Copyright (C) 1991, 1992 Linus Torvalds
4 * Copyright 2007 rPath, Inc. - All Rights Reserved
6 * This file is part of the Linux kernel, and is made available under
7 * the terms of the GNU General Public License version 2.
9 * ----------------------------------------------------------------------- */
12 * Very simple screen I/O
13 * XXX: Probably should add very simple serial I/O?
19 * These functions are in .inittext so they can be used to signal
20 * error during initialization.
23 void __attribute__((section(".inittext"))) putchar(int ch)
28 putchar('\r'); /* \n -> \r\n */
30 /* int $0x10 is known to have bugs involving touching registers
31 it shouldn't. Be extra conservative... */
32 asm volatile("pushal; pushw %%ds; int $0x10; popw %%ds; popal"
33 : : "b" (0x0007), "c" (0x0001), "a" (0x0e00|ch));
36 void __attribute__((section(".inittext"))) puts(const char *str)
46 * Read the CMOS clock through the BIOS, and return the
50 static u8 gettime(void)
55 asm volatile("int $0x1a"
56 : "+a" (ax), "=c" (cx), "=d" (dx)
57 : : "ebx", "esi", "edi");
63 * Read from the keyboard
68 asm volatile("int $0x16" : "+a" (ax));
73 static int kbd_pending(void)
76 asm volatile("int $0x16; setnz %0"
91 int getchar_timeout(void)
109 return 0; /* Timeout! */