linux-user: Replace __u64 with uint64_t
PATCH 1/1 linux-user: Replace __u64 with uint64_t
uint64_t is available in all userspaces via compiler include stdint.h therefore use it instead of __u64 which is linux internal type, it fixes build on some platforms eg. aarch64 systems using musl C library
--- linux-user/host/aarch64/hostdep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
linux-user/host/aarch64/hostdep.h +1 -1
@@ -25,7 +25,7 @@ extern char safe_syscall_end[];static inline void rewind_if_in_safe_syscall (void *puc) {ucontext_t *uc = puc; -__u64 *pcreg = &uc->uc_mcontext.pc; +uint64_t *pcreg = &uc->uc_mcontext.pc;if (*pcreg > (uintptr_t )safe_syscall_start && *pcreg < (uintptr_t )safe_syscall_end) {
Signature · 1 line
2.33.1
Quoted 15 lines · Khem Raj
uint64_tis available in all userspaces via compiler includestdint.htherefore use it instead of__u64which is linux internal type, it fixes build on some platforms eg. aarch64 systems using musl C librarySigned-off-by Khem Raj <[email protected]>--- linux-user/host/aarch64/hostdep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)linux-user/host/aarch64/hostdep.h +0
-0
linux-user/host/aarch64/hostdep.h extern char safe_syscall_end[]; · line 31
Quoted 8 lines
linux-user/host/aarch64/hostdep.h +1
-1@@ -25,7 +25,7 @@ extern char safe_syscall_end[];static inline void rewind_if_in_safe_syscall (void *puc) {ucontext_t *uc = puc; -__u64 *pcreg = &uc->uc_mcontext.pc; +uint64_t *pcreg = &uc->uc_mcontext.pc;if (*pcreg > (uintptr_t )safe_syscall_start && *pcreg < (uintptr_t )safe_syscall_end) {
Quoted 18 lines · Khem Raj
uint64_tis available in all userspaces via compiler includestdint.htherefore use it instead of__u64which is linux internal type, it fixes build on some platforms eg. aarch64 systems using musl C librarySigned-off-by Khem Raj <[email protected]>---
linux-user/host/aarch64/hostdep.h| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)linux-user/host/aarch64/hostdep.h +0
-0
linux-user/host/aarch64/hostdep.h extern char safe_syscall_end[]; · line 31
Quoted 8 lines
linux-user/host/aarch64/hostdep.h +1
-1@@ -25,7 +25,7 @@ extern char safe_syscall_end[];static inline void rewind_if_in_safe_syscall (void *puc) {ucontext_t *uc = puc; -__u64 *pcreg = &uc->uc_mcontext.pc; +uint64_t *pcreg = &uc->uc_mcontext.pc;if (*pcreg > (uintptr_t )safe_syscall_start && *pcreg < (uintptr_t )safe_syscall_end) {
I wonder why we don’t have a typedef like bed’s register_t though…
Richard Henderson
AppliedQuoted 14 lines · Khem Raj
uint64_tis available in all userspaces via compiler includestdint.htherefore use it instead of__u64which is linux internal type, it fixes build on some platforms eg. aarch64 systems using musl C librarySigned-off-by Khem Raj <[email protected]>--- linux-user/host/aarch64/hostdep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)linux-user/host/aarch64/hostdep.h +0
-0
linux-user/host/aarch64/hostdep.h extern char safe_syscall_end[]; · line 31
Quoted 8 lines
linux-user/host/aarch64/hostdep.h +1
-1@@ -25,7 +25,7 @@ extern char safe_syscall_end[];static inline void rewind_if_in_safe_syscall (void *puc) {ucontext_t *uc = puc; -__u64 *pcreg = &uc->uc_mcontext.pc; +uint64_t *pcreg = &uc->uc_mcontext.pc;if (*pcreg > (uintptr_t )safe_syscall_start && *pcreg < (uintptr_t )safe_syscall_end) {
Queued to tcg-next, since that's where the original patch came from.
r~
Quoted 10 lines · Richard Henderson
Quoted 9 lines · Khem Raj
uint64_tis available in all userspaces via compiler includestdint.htherefore use it instead of__u64which is linux internal type, it fixes build on some platforms eg. aarch64 systems using musl C librarySigned-off-by Khem Raj <[email protected]>---
linux-user/host/aarch64/hostdep.h| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines
Quoted 10 lines
linux-user/host/aarch64/hostdep.h +1
-1@@ -25,7 +25,7 @@ extern char safe_syscall_end[]; static inline void rewind_if_in_safe_syscall(void *puc) { ucontext_t *uc = puc; - __u64 *pcreg = &uc->uc_mcontext.pc; + uint64_t *pcreg = &uc->uc_mcontext.pc;Quoted 2 lines
if (*pcreg > (uintptr_t)safe_syscall_start && *pcreg < (uintptr_t)safe_syscall_end) {
Queued to tcg-next, since that's where the original patch came from.
Dequeued. We need something more, because on debian we now get:
../linux-user/host/aarch64/hostdep.h:28:23: error: initialization of 'uint64_t *' {aka 'long unsigned int *'} from incompatible pointer type 'long long unsigned int *' [-Werror=incompatible-pointer-types]
uint64_t *pcreg = &uc->uc_mcontext.pc;
^cc1: all warnings being treated as errors
Perhaps we need to use __typeof() to get the correct pointer type? Oh for c++11 auto declarations... :-)
r~
Quoted 26 lines · Richard Henderson
Quoted 10 lines · Richard Henderson
Quoted 9 lines · Khem Raj
uint64_tis available in all userspaces via compiler includestdint.htherefore use it instead of__u64which is linux internal type, it fixes build on some platforms eg. aarch64 systems using musl C librarySigned-off-by Khem Raj <[email protected]>---
linux-user/host/aarch64/hostdep.h| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)Quoted 14 lines
Quoted 10 lines
linux-user/host/aarch64/hostdep.h +1
-1@@ -25,7 +25,7 @@ extern char safe_syscall_end[]; static inline void rewind_if_in_safe_syscall(void *puc) { ucontext_t *uc = puc; - __u64 *pcreg = &uc->uc_mcontext.pc; + uint64_t *pcreg = &uc->uc_mcontext.pc;Quoted 2 lines
if (*pcreg > (uintptr_t)safe_syscall_start && *pcreg < (uintptr_t)safe_syscall_end) {
Queued to tcg-next, since that's where the original patch came from.
Quoted 8 lines
Dequeued. We need something more, because on debian we now get:
../linux-user/host/aarch64/hostdep.h:28:23: error: initialization of 'uint64_t*' {aka 'long unsigned int *'} from incompatible pointer type 'long long unsigned int *' [-Werror=incompatible-pointer-types]
uint64_t*pcreg =&uc->uc_mcontext.pc;
^
cc1: all warnings being treated as errorsPerhaps we need to use
__typeof()to get the correct pointer type? Oh for c++11 auto declarations... :-)
No, we need to not use a pointer at all and grab Warner's
https://patchew.org/QEMU/[email protected]/
Even grabbing the first two patches of that series for 6.2 would fix this.
r~
Quoted 41 lines · Richard Henderson
Quoted 4 lines · Richard Henderson
Quoted 3 lines · Richard Henderson
Quoted 2 lines · Khem Raj
uint64_tis available in all userspaces via compiler includestdint.htherefore use it instead of__u64which is linux internal type, itfixes
Quoted 8 lines
Quoted 8 lines
Review
Quoted 8 lines
build on some platforms eg. aarch64 systems using musl C library
Signed-off-by Khem Raj <[email protected]>--- linux-user/host/aarch64/hostdep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/linux-user/host/aarch64/hostdep.hQuoted 14 lines
Quoted 5 lines
Quoted 5 lines
index
a8d41a21ad..34d934f665100644linux-user/host/aarch64/hostdep.h +0
-0@@ -25,7 +25,7 @@ extern char safe_syscall_end[];static inline void rewind_if_in_safe_syscall (void *puc)Quoted 8 lines
linux-user/host/aarch64/hostdep.h extern char safe_syscall_end[]; · line 31
Quoted 6 lines
linux-user/host/aarch64/hostdep.h +1
-1{ucontext_t *uc = puc; -__u64 *pcreg = &uc->uc_mcontext.pc; +uint64_t *pcreg = &uc->uc_mcontext.pc;if (*pcreg > (uintptr_t )safe_syscall_start && *pcreg < (uintptr_t )safe_syscall_end) {Queued to tcg-next, since that's where the original patch came from.
Quoted 3 lines
Dequeued. We need something more, because on debian we now get:
../linux-user/host/aarch64/hostdep.h:28:23: error: initialization of'
uint64_t*' {akaQuoted 1 line
'long unsigned int *'} from incompatible pointer type 'long long
unsigned int *'
Quoted 6 lines
[-Werror=incompatible-pointer-types]
uint64_t *pcreg = &uc->uc_mcontext.pc; ^cc1: all warnings being treated as errors
Perhaps we need to use
__typeof()to get the correct pointer type? Oh
Quoted 9 lines
for c++11 auto
Quoted 1 line
declarations... :-)
No, we need to not use a pointer at all and grab Warner's
https://patchew.org/QEMU/[email protected]/Even grabbing the first two patches of that series for 6.2 would fix this.
I tried to do a pointer for this stuff, only to find several places where there
were mismatches like's reported there.
I also have an improvement to that series I was going to send later today that fixes the check-patch warning by moving some externs around. I was going to do that after looking through my inbox to see if there'd been more comments or not. I'll make sure the relevant fixes are first for this issue.
Warner
Quoted 51 lines · Warner Losh
Quoted 37 lines · Richard Henderson
Quoted 35 lines · Richard Henderson
Quoted 10 lines · Richard Henderson
Quoted 9 lines · Khem Raj
uint64_tis available in all userspaces via compiler includestdint.htherefore use it instead of__u64which is linux internal type, it fixes build on some platforms eg. aarch64 systems using musl C librarySigned-off-by Khem Raj <[email protected]>--- linux-user/host/aarch64/hostdep.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 14 lines
linux-user/host/aarch64/hostdep.h extern char safe_syscall_end[]; · line 30
Quoted 12 lines
linux-user/host/aarch64/hostdep.h +1
-1@@ -25,7 +25,7 @@ extern char safe_syscall_end[];static inline void rewind_if_in_safe_syscall (void *puc) {ucontext_t *uc = puc; -__u64 *pcreg = &uc->uc_mcontext.pc; +uint64_t *pcreg = &uc->uc_mcontext.pc;if (*pcreg > (uintptr_t )safe_syscall_start && *pcreg < (uintptr_t )safe_syscall_end) {Queued to tcg-next, since that's where the original patch came from.
Dequeued. We need something more, because on debian we now get:
../linux-user/host/aarch64/hostdep.h:28:23: error: initialization of 'uint64_t*' {aka 'long unsigned int *'} from incompatible pointer type 'long long unsigned int *' [-Werror=incompatible-pointer-types]uint64_t *pcreg = &uc->uc_mcontext.pc; ^cc1: all warnings being treated as errors
Quoted 8 lines
Quoted 2 lines
Perhaps we need to use
__typeof()to get the correct pointer type? Oh for c++11 auto declarations... :-)No, we need to not use a pointer at all and grab Warner's
https://patchew.org/QEMU/[email protected]/Even grabbing the first two patches of that series for 6.2 would fix this.
Quoted 7 lines
I tried to do a pointer for this stuff, only to find several places where there were mismatches like's reported there.
I also have an improvement to that series I was going to send later today that fixes the check-patch warning by moving some externs around. I was going to do that after looking through my inbox to see if there'd been more comments or not. I'll make sure the relevant fixes are first for this issue.
Thanks Warner, if you are fixing it in your series, then we should drop this. Should we
use uintptr_t or something
Quoted 2 lines
Warner