cachepc-qemu

Fork of AMDESE/qemu with changes for cachepc side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-qemu
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

libc.h (1962B)


      1/*
      2 * Copyright (c) 2013 Kevin Wolf <kwolf@redhat.com>
      3 *
      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:
     10 *
     11 * The above copyright notice and this permission notice shall be included in
     12 * all copies or substantial portions of the Software.
     13 *
     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.
     21 */
     22
     23#ifndef LIBC_H
     24#define LIBC_H
     25
     26/* Integer types */
     27
     28typedef unsigned long long uint64_t;
     29typedef unsigned int uint32_t;
     30typedef unsigned short uint16_t;
     31typedef unsigned char uint8_t;
     32
     33typedef signed long long int64_t;
     34typedef signed int int32_t;
     35typedef signed short int16_t;
     36typedef signed char int8_t;
     37
     38typedef uint32_t uintptr_t;
     39
     40
     41/* stdarg.h */
     42
     43typedef __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)
     47
     48
     49/* Port I/O functions */
     50
     51static inline void outb(uint16_t port, uint8_t data)
     52{
     53    asm volatile ("outb %0, %1" : : "a" (data), "Nd" (port));
     54}
     55
     56
     57/* Misc functions */
     58
     59void printf(const char *fmt, ...);
     60void* memcpy(void *dest, const void *src, int n);
     61
     62#endif