14692a86fSAlex Bennée /* 24692a86fSAlex Bennée * Target Long Definitions 34692a86fSAlex Bennée * 44692a86fSAlex Bennée * Copyright (c) 2003 Fabrice Bellard 54692a86fSAlex Bennée * Copyright (c) 2023 Linaro Ltd 64692a86fSAlex Bennée * 74692a86fSAlex Bennée * SPDX-License-Identifier: GPL-2.0-or-later 84692a86fSAlex Bennée */ 94692a86fSAlex Bennée 104692a86fSAlex Bennée #ifndef _TARGET_LONG_H_ 114692a86fSAlex Bennée #define _TARGET_LONG_H_ 124692a86fSAlex Bennée 134692a86fSAlex Bennée /* 144692a86fSAlex Bennée * Usually this should only be included via cpu-defs.h however for 154692a86fSAlex Bennée * certain cases where we want to build only two versions of a binary 164692a86fSAlex Bennée * object we can include directly. However the build-system must 174692a86fSAlex Bennée * ensure TARGET_LONG_BITS is defined directly. 184692a86fSAlex Bennée */ 194692a86fSAlex Bennée #ifndef TARGET_LONG_BITS 204692a86fSAlex Bennée #error TARGET_LONG_BITS not defined 214692a86fSAlex Bennée #endif 224692a86fSAlex Bennée 234692a86fSAlex Bennée #define TARGET_LONG_SIZE (TARGET_LONG_BITS / 8) 244692a86fSAlex Bennée 254692a86fSAlex Bennée /* target_ulong is the type of a virtual address */ 264692a86fSAlex Bennée #if TARGET_LONG_SIZE == 4 274692a86fSAlex Bennée typedef int32_t target_long; 284692a86fSAlex Bennée typedef uint32_t target_ulong; 294692a86fSAlex Bennée #define TARGET_FMT_lx "%08x" 304692a86fSAlex Bennée #define TARGET_FMT_ld "%d" 314692a86fSAlex Bennée #define TARGET_FMT_lu "%u" 32*c048b683SPaolo Bonzini #define MO_TL MO_32 334692a86fSAlex Bennée #elif TARGET_LONG_SIZE == 8 344692a86fSAlex Bennée typedef int64_t target_long; 354692a86fSAlex Bennée typedef uint64_t target_ulong; 364692a86fSAlex Bennée #define TARGET_FMT_lx "%016" PRIx64 374692a86fSAlex Bennée #define TARGET_FMT_ld "%" PRId64 384692a86fSAlex Bennée #define TARGET_FMT_lu "%" PRIu64 39*c048b683SPaolo Bonzini #define MO_TL MO_64 404692a86fSAlex Bennée #else 414692a86fSAlex Bennée #error TARGET_LONG_SIZE undefined 424692a86fSAlex Bennée #endif 434692a86fSAlex Bennée 444692a86fSAlex Bennée #endif /* _TARGET_LONG_H_ */ 45