1/** 2 * \file 3 * \brief Definitions of standard Barrelfish types. 4 */ 5 6/* 7 * Copyright (c) 2007, 2008, 2010, 2012, 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_KPI_TYPES_H 16#define BARRELFISH_KPI_TYPES_H 17 18/* Number of bits in a byte */ 19#define NBBY 8 20 21/// Capability NULL pointer 22#define CPTR_NULL ((capaddr_t)0) 23 24#ifndef __ASSEMBLER__ 25 26#include <stdint.h> 27#include <stddef.h> 28#include <inttypes.h> 29#include <barrelfish/static_assert.h> 30 31/* natural machine word size */ 32typedef signed int word_t; 33typedef unsigned int uword_t; 34 35/* Local physical address. */ 36typedef uintptr_t lpaddr_t; 37#define PRIuLPADDR PRIuPTR 38#define PRIxLPADDR PRIxPTR 39#define SCNuLPADDR SCNuPTR 40 41/* Global (system-wide) physical address, currently 64 bits */ 42typedef uint64_t genpaddr_t; 43#define PRIuGENPADDR PRIu64 44#define PRIxGENPADDR PRIx64 45 46/* Global (system-wide) size type, currently 64 bits */ 47typedef uint64_t gensize_t; 48#define PRIuGENSIZE PRIu64 49#define PRIxGENSIZE PRIx64 50 51/* Local virtual address */ 52typedef uintptr_t lvaddr_t; 53#define PRIuLVADDR PRIuPTR 54#define PRIxLVADDR PRIxPTR 55 56/* Global (system-wide) virtual address, currently 64 bits */ 57typedef uint64_t genvaddr_t; 58#define PRIuGENVADDR PRIu64 59#define PRIxGENVADDR PRIx64 60 61/* A virtual address in a foreign address space. */ 62typedef genvaddr_t forvaddr_t; 63#define PRIuFORVADDR PRIuGENVADDR 64#define PRIxFORVADDR PRIxGENVADDR 65 66/* capability addresses */ 67typedef uint32_t capaddr_t; 68#define PRIuCADDR PRIu32 69#define PRIxCADDR PRIx32 70 71/* physical address space identifier */ 72typedef uint32_t pasid_t; 73#define PRIuPASID PRIu32 74#define PRIxPASID PRIx32 75 76/// Number of bits in a cspace address 77#define CPTR_BITS (sizeof(capaddr_t) * NBBY) 78 79/* slot number */ 80typedef capaddr_t cslot_t; 81#define PRIuCSLOT PRIuCADDR 82#define PRIxCSLOT PRIxCADDR 83 84/* core id type */ 85// This is also used as a count of cores, so the maximum core ID must be 86// one less than the maximum value representable here. 87typedef uint8_t coreid_t; 88#define PRIuCOREID PRIu8 89#define PRIxCOREID PRIx8 90 91#ifndef MAX_COREID 92#define MAX_COREID 254 // limit of coreid_t type (see comment above) 93#endif 94 95/* node id type */ 96typedef coreid_t nodeid_t; 97#define PRIuNODEID PRIu8 98#define SCNuNODEID SCNu8 99#define PRIxNODEID PRIx8 100 101#ifndef MAX_NODEID 102#define MAX_NODEID 255 103#endif 104 105/* hardware id (apic, mpdir, ...) */ 106typedef uintptr_t hwid_t; 107#define PRIuHWID PRIu64 108#define PRIxHWID PRIx64 109 110/* ID capability ID */ 111// Returned if IDCmd_Identify is invoked on an ID capability. 112typedef uint64_t idcap_id_t; 113#define PRIuIDCAPID PRIu64 114#define PRIxIDCAPID PRIx64 115 116/* Resource id */ 117typedef uint32_t rsrcid_t; 118#define PRIuRSRCID PRIu32 119#define PRIxRSRCID PRIx32 120 121/* Domain ID */ 122typedef uint32_t domainid_t; 123#define MAX_DOMAINID 0xffffffff 124#define PRIuDOMAINID PRIu32 125#define PRIxDOMAINID PRIx32 126 127/* Performance counter */ 128// Performance counter 129typedef uint8_t perfmon_counter_t; 130// Performance event 131typedef uint64_t perfmon_event_t; 132// Performance mask 133typedef uint64_t perfmon_mask_t; 134 135/// Absolute system wallclock time in ticks 136typedef uint64_t systime_t; 137#define PRIuSYSTIME PRIu64 138#define PRIxSYSTIME PRIx64 139#define PRIXSYSTIME PRIX64 140 141#define PRIxERRV PRIxPTR 142#define PRIuERRV PRIuPTR 143 144#endif // __ASSEMBLER__ 145 146#endif // BARRELFISH_KPI_TYPES_H 147