ia64/xen-unstable

view extras/mini-os/include/types.h @ 16838:945820bfedb6

minios: POSIX fixes
Fixes some functions which are POSIX. Also make them ifndef HAVE_LIBC.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jan 22 14:20:22 2008 +0000 (2008-01-22)
parents d5e22e766d1f
children 8bd776540ab3
line source
1 /* -*- Mode:C; c-basic-offset:4; tab-width:4 -*-
2 ****************************************************************************
3 * (C) 2003 - Rolf Neugebauer - Intel Research Cambridge
4 ****************************************************************************
5 *
6 * File: types.h
7 * Author: Rolf Neugebauer (neugebar@dcs.gla.ac.uk)
8 * Changes:
9 *
10 * Date: May 2003
11 *
12 * Environment: Xen Minimal OS
13 * Description: a random collection of type definitions
14 *
15 ****************************************************************************
16 * $Id: h-insert.h,v 1.4 2002/11/08 16:03:55 rn Exp $
17 ****************************************************************************
18 */
20 #ifndef _TYPES_H_
21 #define _TYPES_H_
22 #include <stddef.h>
24 typedef signed char s8;
25 typedef unsigned char u8;
26 typedef signed short s16;
27 typedef unsigned short u16;
28 typedef signed int s32;
29 typedef unsigned int u32;
30 #ifdef __i386__
31 typedef signed long long s64;
32 typedef unsigned long long u64;
33 #elif defined(__x86_64__) || defined(__ia64__)
34 typedef signed long s64;
35 typedef unsigned long u64;
36 #endif
38 /* FreeBSD compat types */
39 typedef unsigned char u_char;
40 typedef unsigned int u_int;
41 typedef unsigned long u_long;
42 #ifdef __i386__
43 typedef long long quad_t;
44 typedef unsigned long long u_quad_t;
46 #if !defined(CONFIG_X86_PAE)
47 typedef struct { unsigned long pte_low; } pte_t;
48 #else
49 typedef struct { unsigned long pte_low, pte_high; } pte_t;
50 #endif /* CONFIG_X86_PAE */
52 #elif defined(__x86_64__) || defined(__ia64__)
53 typedef long quad_t;
54 typedef unsigned long u_quad_t;
56 typedef struct { unsigned long pte; } pte_t;
57 #endif /* __i386__ || __x86_64__ */
59 #if !defined(CONFIG_X86_PAE)
60 #define __pte(x) ((pte_t) { (x) } )
61 #else
62 #define __pte(x) ({ unsigned long long _x = (x); \
63 ((pte_t) {(unsigned long)(_x), (unsigned long)(_x>>32)}); })
64 #endif
66 #ifdef HAVE_LIBC
67 #include <limits.h>
68 #include <stdint.h>
69 #else
70 #ifdef __i386__
71 typedef unsigned int uintptr_t;
72 typedef int intptr_t;
73 #elif defined(__x86_64__) || defined(__ia64__)
74 typedef unsigned long uintptr_t;
75 typedef long intptr_t;
76 #endif /* __i386__ || __x86_64__ */
77 typedef u8 uint8_t;
78 typedef s8 int8_t;
79 typedef u16 uint16_t;
80 typedef s16 int16_t;
81 typedef u32 uint32_t;
82 typedef s32 int32_t;
83 typedef u64 uint64_t, uintmax_t;
84 typedef s64 int64_t, intmax_t;
85 typedef u64 off_t;
88 #define INT_MAX ((int)(~0U>>1))
89 #define UINT_MAX (~0U)
91 typedef long ssize_t;
92 #endif
93 #endif /* _TYPES_H_ */