1*4692a86fSAlex Bennée /* 2*4692a86fSAlex Bennée * Target Long Definitions 3*4692a86fSAlex Bennée * 4*4692a86fSAlex Bennée * Copyright (c) 2003 Fabrice Bellard 5*4692a86fSAlex Bennée * Copyright (c) 2023 Linaro Ltd 6*4692a86fSAlex Bennée * 7*4692a86fSAlex Bennée * SPDX-License-Identifier: GPL-2.0-or-later 8*4692a86fSAlex Bennée */ 9*4692a86fSAlex Bennée 10*4692a86fSAlex Bennée #ifndef _TARGET_LONG_H_ 11*4692a86fSAlex Bennée #define _TARGET_LONG_H_ 12*4692a86fSAlex Bennée 13*4692a86fSAlex Bennée /* 14*4692a86fSAlex Bennée * Usually this should only be included via cpu-defs.h however for 15*4692a86fSAlex Bennée * certain cases where we want to build only two versions of a binary 16*4692a86fSAlex Bennée * object we can include directly. However the build-system must 17*4692a86fSAlex Bennée * ensure TARGET_LONG_BITS is defined directly. 18*4692a86fSAlex Bennée */ 19*4692a86fSAlex Bennée #ifndef TARGET_LONG_BITS 20*4692a86fSAlex Bennée #error TARGET_LONG_BITS not defined 21*4692a86fSAlex Bennée #endif 22*4692a86fSAlex Bennée 23*4692a86fSAlex Bennée #define TARGET_LONG_SIZE (TARGET_LONG_BITS / 8) 24*4692a86fSAlex Bennée 25*4692a86fSAlex Bennée /* target_ulong is the type of a virtual address */ 26*4692a86fSAlex Bennée #if TARGET_LONG_SIZE == 4 27*4692a86fSAlex Bennée typedef int32_t target_long; 28*4692a86fSAlex Bennée typedef uint32_t target_ulong; 29*4692a86fSAlex Bennée #define TARGET_FMT_lx "%08x" 30*4692a86fSAlex Bennée #define TARGET_FMT_ld "%d" 31*4692a86fSAlex Bennée #define TARGET_FMT_lu "%u" 32*4692a86fSAlex Bennée #elif TARGET_LONG_SIZE == 8 33*4692a86fSAlex Bennée typedef int64_t target_long; 34*4692a86fSAlex Bennée typedef uint64_t target_ulong; 35*4692a86fSAlex Bennée #define TARGET_FMT_lx "%016" PRIx64 36*4692a86fSAlex Bennée #define TARGET_FMT_ld "%" PRId64 37*4692a86fSAlex Bennée #define TARGET_FMT_lu "%" PRIu64 38*4692a86fSAlex Bennée #else 39*4692a86fSAlex Bennée #error TARGET_LONG_SIZE undefined 40*4692a86fSAlex Bennée #endif 41*4692a86fSAlex Bennée 42*4692a86fSAlex Bennée #endif /* _TARGET_LONG_H_ */ 43