Ronald G. Minnich | 95c331b | 2018-09-14 01:21:05 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 20 | void buts(char *s) |
| 21 | { |
| 22 | int i; |
| 23 | for (i = 0; i < strlen(s); i++) |
| 24 | outb(s[i], 0x3f8); |
| 25 | } |
| 26 | |
| 27 | void hex4(u8 c) |
| 28 | { |
| 29 | static char *hex = "0123456789abcdef"; |
| 30 | outb(hex[c & 0xf], 0x3f8); |
| 31 | } |
| 32 | |
| 33 | void hex8(u8 c) |
| 34 | { |
| 35 | hex4(c >> 4); |
| 36 | hex4(c); |
| 37 | } |
| 38 | |
| 39 | void hex16(u16 c) |
| 40 | { |
| 41 | hex8((u8)(c >> 8)); |
| 42 | hex8((u8)c); |
| 43 | } |
| 44 | void hex32(u32 c) |
| 45 | { |
| 46 | hex16((u16)(c >> 16)); |
| 47 | hex16((u16)c); |
| 48 | } |