1d1f3a23bSKevin Wolf /*
2d1f3a23bSKevin Wolf * Copyright (c) 2013 Kevin Wolf <kwolf@redhat.com>
3d1f3a23bSKevin Wolf *
4d1f3a23bSKevin Wolf * Permission is hereby granted, free of charge, to any person obtaining a copy
5d1f3a23bSKevin Wolf * of this software and associated documentation files (the "Software"), to deal
6d1f3a23bSKevin Wolf * in the Software without restriction, including without limitation the rights
7d1f3a23bSKevin Wolf * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8d1f3a23bSKevin Wolf * copies of the Software, and to permit persons to whom the Software is
9d1f3a23bSKevin Wolf * furnished to do so, subject to the following conditions:
10d1f3a23bSKevin Wolf *
11d1f3a23bSKevin Wolf * The above copyright notice and this permission notice shall be included in
12d1f3a23bSKevin Wolf * all copies or substantial portions of the Software.
13d1f3a23bSKevin Wolf *
14d1f3a23bSKevin Wolf * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15d1f3a23bSKevin Wolf * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16d1f3a23bSKevin Wolf * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17d1f3a23bSKevin Wolf * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18d1f3a23bSKevin Wolf * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19d1f3a23bSKevin Wolf * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20d1f3a23bSKevin Wolf * THE SOFTWARE.
21d1f3a23bSKevin Wolf */
22d1f3a23bSKevin Wolf
23d1f3a23bSKevin Wolf #ifndef LIBC_H
24d1f3a23bSKevin Wolf #define LIBC_H
25d1f3a23bSKevin Wolf
26d1f3a23bSKevin Wolf /* Integer types */
27d1f3a23bSKevin Wolf
28d1f3a23bSKevin Wolf typedef unsigned long long uint64_t;
29d1f3a23bSKevin Wolf typedef unsigned int uint32_t;
30d1f3a23bSKevin Wolf typedef unsigned short uint16_t;
31d1f3a23bSKevin Wolf typedef unsigned char uint8_t;
32d1f3a23bSKevin Wolf
33d1f3a23bSKevin Wolf typedef signed long long int64_t;
34d1f3a23bSKevin Wolf typedef signed int int32_t;
35d1f3a23bSKevin Wolf typedef signed short int16_t;
36d1f3a23bSKevin Wolf typedef signed char int8_t;
37d1f3a23bSKevin Wolf
38d1f3a23bSKevin Wolf typedef uint32_t uintptr_t;
39d1f3a23bSKevin Wolf
40d1f3a23bSKevin Wolf
41d1f3a23bSKevin Wolf /* stdarg.h */
42d1f3a23bSKevin Wolf
43d1f3a23bSKevin Wolf typedef __builtin_va_list va_list;
44d1f3a23bSKevin Wolf #define va_start(ap, X) __builtin_va_start(ap, X)
45d1f3a23bSKevin Wolf #define va_arg(ap, type) __builtin_va_arg(ap, type)
46d1f3a23bSKevin Wolf #define va_end(ap) __builtin_va_end(ap)
47d1f3a23bSKevin Wolf
48d1f3a23bSKevin Wolf
49d1f3a23bSKevin Wolf /* Port I/O functions */
50d1f3a23bSKevin Wolf
outb(uint16_t port,uint8_t data)51d1f3a23bSKevin Wolf static inline void outb(uint16_t port, uint8_t data)
52d1f3a23bSKevin Wolf {
53d1f3a23bSKevin Wolf asm volatile ("outb %0, %1" : : "a" (data), "Nd" (port));
54d1f3a23bSKevin Wolf }
55d1f3a23bSKevin Wolf
56d1f3a23bSKevin Wolf
57d1f3a23bSKevin Wolf /* Misc functions */
58d1f3a23bSKevin Wolf
59d1f3a23bSKevin Wolf void printf(const char *fmt, ...);
60*a9c837d8SKevin Wolf void* memcpy(void *dest, const void *src, int n);
61d1f3a23bSKevin Wolf
62d1f3a23bSKevin Wolf #endif
63