blob: 2b4b541f1ed4a9e67f6bcb76e319d358839f860a [file] [log] [blame]
Ronald G. Minnich95c331b2018-09-14 01:21:05 -07001/*
2 * This file is part of the coreinfo project.
3 *
4 * Copyright (C) 2018 Google Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <libpayload-config.h>
17#include <libpayload.h>
18#include "linuxcheck.h"
19
20void buts(char *s)
21{
22 int i;
23 for (i = 0; i < strlen(s); i++)
24 outb(s[i], 0x3f8);
25}
26
27void hex4(u8 c)
28{
29 static char *hex = "0123456789abcdef";
30 outb(hex[c & 0xf], 0x3f8);
31}
32
33void hex8(u8 c)
34{
35 hex4(c >> 4);
36 hex4(c);
37}
38
39void hex16(u16 c)
40{
41 hex8((u8)(c >> 8));
42 hex8((u8)c);
43}
44void hex32(u32 c)
45{
46 hex16((u16)(c >> 16));
47 hex16((u16)c);
48}