1/** 2 * \file 3 * \brief Definitions of standard Barrelfish userland types. 4 */ 5 6/* 7 * Copyright (c) 2007, 2008, 2010, 2011, ETH Zurich. 8 * All rights reserved. 9 * 10 * This file is distributed under the terms in the attached LICENSE file. 11 * If you do not find this file, copies can be found by writing to: 12 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group. 13 */ 14 15#ifndef BARRELFISH_TYPES_H 16#define BARRELFISH_TYPES_H 17 18#include <barrelfish_kpi/types.h> 19 20/// Cycle count type 21#ifdef __i386__ 22typedef uint64_t cycles_t; // rdtsc() is 64-bit on i386 23#define PRIuCYCLES PRIu64 24#define PRIxCYCLES PRIx64 25#define PRIXCYCLES PRIX64 26#else 27typedef size_t cycles_t; 28#define PRIuCYCLES "zu" 29#define PRIxCYCLES "zx" 30#define PRIXCYCLES "zX" 31#endif 32 33typedef uint32_t iref_t; 34 35#define NULL_IREF 0 36 37#define PRIxIREF PRIx32 38#define PRIuIREF PRIu32 39 40#define BYTES_IN_IREF (sizeof(iref_t) / sizeof(uint8_t)) 41 42/// Relative delay time (in microseconds) 43typedef uint64_t delayus_t; 44#define PRIuDELAYUS PRIu64 45#define PRIxDELAYUS PRIx64 46#define PRIXDELAYUS PRIX64 47 48/// PCI addresses 49typedef uint64_t pciaddr_t; 50#define PRIxPCIADDR PRIx64 51#define PRIuPCIADDR PRIu64 52/// PCI size 53typedef uint64_t pcisize_t; 54#define PRIxPCISIZE PRIx64 55#define PRIuPCISIZE PRIu64 56 57/// MAX_CPUS is a legacy name for max core ID 58#ifdef MAX_CPUS 59STATIC_ASSERT(MAX_CPUS == MAX_COREID, "MAX_CPUS != MAX_COREID") 60#else 61#define MAX_CPUS MAX_COREID 62#endif 63 64/** \brief Core ID bitmask type 65 * 66 * XXX: the coremask_t type is deprecated and should not be used for new code. 67 * For a replacement, see <barrelfish/coreset.h> 68 */ 69 70#ifndef DIVIDE_ROUND_UP 71#define DIVIDE_ROUND_UP(n, size) (((n) + (size) - 1) / (size)) 72#define _DIVIDE_ROUND_UP_DEFINED 1 73#endif 74 75typedef uint64_t _coremask_word_t; 76#define _COREMASK_BITS_PER_WORD (sizeof(_coremask_word_t) * NBBY) 77#define _COREMASK_WORDS DIVIDE_ROUND_UP(MAX_COREID, _COREMASK_BITS_PER_WORD) 78 79typedef struct { 80 _coremask_word_t bits[_COREMASK_WORDS]; 81} coremask_t; 82 83#ifdef _DIVIDE_ROUND_UP_DEFINED 84#undef DIVIDE_ROUND_UP 85#undef _DIVIDE_ROUND_UP_DEFINED 86#endif 87 88#endif // TYPES_H 89