xref: /qemu/pc-bios/s390-ccw/libc.h (revision 2562755e)
1 /*
2  * libc-style definitions and functions
3  *
4  * This code is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  */
9 
10 #ifndef S390_CCW_LIBC_H
11 #define S390_CCW_LIBC_H
12 
13 typedef long               size_t;
14 typedef int                bool;
15 typedef unsigned char      uint8_t;
16 typedef unsigned short     uint16_t;
17 typedef unsigned int       uint32_t;
18 typedef unsigned long long uint64_t;
19 
20 static inline void *memset(void *s, int c, size_t n)
21 {
22     int i;
23     unsigned char *p = s;
24 
25     for (i = 0; i < n; i++) {
26         p[i] = c;
27     }
28 
29     return s;
30 }
31 
32 static inline void *memcpy(void *s1, const void *s2, size_t n)
33 {
34     uint8_t *dest = s1;
35     const uint8_t *src = s2;
36     int i;
37 
38     for (i = 0; i < n; i++) {
39         dest[i] = src[i];
40     }
41 
42     return s1;
43 }
44 
45 #endif
46