util/cacheinfo.c: Use uintptr_t instead of unsigned long in AArch64 arch_cache_info()
PATCH v2 3/4 util/cacheinfo.c: Use uintptr_t instead of unsigned long in AArch64 arch_cache_info()
Windows ARM64 uses LLP64 model, which breaks current assumptions.
--- util/cacheinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
util/cacheinfo.c +1 -1
@@ -107,7 +107,7 @@ static void sys_cache_info(int *isize, int *dsize)static void arch_cache_info (int *isize,int *dsize) {if (*isize ==0 || *dsize ==0 ) { -unsigned long ctr; +uintptr_t ctr;/* The real cache geometry is in CCSIDR_EL1/CLIDR_EL1/CSSELR_EL1, but (at least under Linux) these are marked protected by the
Signature · 1 line
2.17.1
Quoted 13 lines · Cao Jiaxi
Windows ARM64 uses LLP64 model, which breaks current assumptions.
Signed-off-by Cao Jiaxi <[email protected]>--- util/cacheinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)util/cacheinfo.c +0
-0
util/cacheinfo.c static void sys_cache_info(int *isize, int *dsize) · line 113
Quoted 8 lines
util/cacheinfo.c +1
-1@@ -107,7 +107,7 @@ static void sys_cache_info(int *isize, int *dsize)static void arch_cache_info (int *isize,int *dsize) {if (*isize ==0 || *dsize ==0 ) { -unsigned long ctr; +uintptr_t ctr;/* The real cache geometry is in CCSIDR_EL1/CLIDR_EL1/CSSELR_EL1, but (at least under Linux) these are marked protected by the
Quoted 19 lines · Philippe Mathieu-Daudé
Quoted 18 lines · Cao Jiaxi
Windows ARM64 uses LLP64 model, which breaks current assumptions.
Signed-off-by Cao Jiaxi <[email protected]>--- util/cacheinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)util/cacheinfo.c +1
-1@@ -107,7 +107,7 @@ static void sys_cache_info(int *isize, int *dsize)static void arch_cache_info (int *isize,int *dsize) {if (*isize ==0 || *dsize ==0 ) { -unsigned long ctr; +uintptr_t ctr;
Quoted 6 lines
util/cacheinfo.c static void sys_cache_info(int *isize, int *dsize) · line 113
Quoted 3 lines
util/cacheinfo.c +0
-0/* The real cache geometry is in CCSIDR_EL1/CLIDR_EL1/CSSELR_EL1, but (at least under Linux) these are marked protected by the Reviewed-by Philippe Mathieu-Daudé <[email protected]>
Maybe you can use a shorter commit subject, such "util/cacheinfo: Use uintptr_t on LLP64 model to satisfy Windows ARM64" (or better), so it won't be cut in git log (limited to 72 chars).
Quoted 12 lines · Cao Jiaxi
Windows ARM64 uses LLP64 model, which breaks current assumptions.
Signed-off-by Cao Jiaxi <[email protected]>--- util/cacheinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)util/cacheinfo.c +0
-0
util/cacheinfo.c static void sys_cache_info(int *isize, int *dsize) · line 110
Quoted 5 lines
util/cacheinfo.c +1
-1@@ -107,7 +107,7 @@ static void sys_cache_info(int *isize, int *dsize)static void arch_cache_info (int *isize,int *dsize) {if (*isize ==0 || *dsize ==0 ) { -unsigned long ctr; +uintptr_t ctr;
Looking at the whole function, is uintptr_t really the right type to use here? ctr does not seem to contain the value of a pointer variable, so this looks wrong to me...
Do you get a compiler warning here? If so, how does it look like? Anyway, I think it would be better to use a uint64_t or uint32_t type here instead if possible?
Thomas
Quoted 5 lines · Thomas Huth
Quoted 5 lines
util/cacheinfo.c +0
-1@@ -107,7 +107,7 @@ static void sys_cache_info(int *isize, int *dsize)static void arch_cache_info (int *isize,int *dsize) {if (*isize ==0 || *dsize ==0 ) { -unsigned long ctr;
Quoted 8 lines
util/cacheinfo.c static void sys_cache_info(int *isize, int *dsize) · line 110
Quoted 1 line
util/cacheinfo.c +1
-0+uintptr_t ctr;Looking at the whole function, is
uintptr_treally the right type to use here? ctr does not seem to contain the value of a pointer variable, so this looks wrong to me...
Do you get a compiler warning here? If so, how does it look like? Anyway, I think it would be better to use auint64_toruint32_ttype here instead if possible?
uint64_t is the proper type to use with MRS.
r~