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