Skip to contentSkip to conversation

util/cacheinfo.c: Use uintptr_t instead of unsigned long in AArch64 arch_cache_info()

PATCH Superseded driver1998 3 participants 3 messages Apr 29, 2019 – Apr 30, 2019

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

driver1998

author
#0 lore raw

PATCH 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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
util/cacheinfo.c +3 -1
index 3cd080b83d..a815cb0722 100644
@@ -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
@@ -120,6 +120,8 @@ static void arch_cache_info(int *isize, int *dsize)
         if (*dsize == 0) {
             *dsize = 4 << ((ctr >> 16) & 0xf);
         }
+
+        printf("%d %d\n", *isize, *dsize);
     }
 }
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 21 lines · On 4/29/19 2:33 AM, driver1998 wrote:

Windows ARM64 uses LLP64 model, which breaks current assumptions.

---
 util/cacheinfo.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
util/cacheinfo.c +1 -1
index 3cd080b83d..a815cb0722 100644
@@ -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

util/cacheinfo.c static void arch_cache_info(int *isize, int *dsize) · line 124

Quoted 5 lines
util/cacheinfo.c +2 -0
@@ -120,6 +120,8 @@ static void arch_cache_info(int *isize, int *dsize)
         if (*dsize == 0) {
             *dsize = 4 << ((ctr >> 16) & 0xf);
         }
+
+        printf("%d %d\n", *isize, *dsize);

The patch looks correct (except your real name), but here you forgot to remove this debugging code.

Quoted 4 lines
util/cacheinfo.c +0 -0
     }
 }
 
#2 lore raw
Quoted 19 lines · Philippe Mathieu-Daudé
Quoted 18 lines · On 4/29/19 2:33 AM, driver1998 wrote:

Windows ARM64 uses LLP64 model, which breaks current assumptions.

---
 util/cacheinfo.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
util/cacheinfo.c +1 -1
index 3cd080b83d..a815cb0722 100644
@@ -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 11 lines

util/cacheinfo.c static void arch_cache_info(int *isize, int *dsize) · line 124

Quoted 8 lines
util/cacheinfo.c +2 -0
         /* The real cache geometry is in CCSIDR_EL1/CLIDR_EL1/CSSELR_EL1,
            but (at least under Linux) these are marked protected by the
@@ -120,6 +120,8 @@ static void arch_cache_info(int *isize, int *dsize)
         if (*dsize == 0) {
             *dsize = 4 << ((ctr >> 16) & 0xf);
         }
+
+        printf("%d %d\n", *isize, *dsize);

The patch looks correct (except your real name), but here you forgot to remove this debugging code.

Right. With the "Signed-off-by" line you have to state that you've read and followed the "Developer's Certificate of Origin". For this, no pseudonym contributions are possible, sorry.
See this URLs for details:

https://wiki.qemu.org/Contribute/SubmitAPatch#Patch_emails_must_include_a_Signed-off-by:_line

Thomas