about summary refs log tree commit diff stats
path: root/src/libtools
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-03-05 19:14:47 +0100
committerptitSeb <sebastien.chev@gmail.com>2021-03-05 19:14:47 +0100
commit90c81ecaa3c2974b105d951556104946e5317493 (patch)
tree5605d264216aab3769712eb0451b57afc5c5286b /src/libtools
parent7694594f8b346cda6c9f79014ca7e563496d86f7 (diff)
downloadbox64-90c81ecaa3c2974b105d951556104946e5317493.tar.gz
box64-90c81ecaa3c2974b105d951556104946e5317493.zip
Somes fixes to float/double/long double handling in va_list
Diffstat (limited to 'src/libtools')
-rwxr-xr-xsrc/libtools/myalign.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libtools/myalign.c b/src/libtools/myalign.c
index c621fc64..be5773f8 100755
--- a/src/libtools/myalign.c
+++ b/src/libtools/myalign.c
@@ -22,6 +22,7 @@ void myStackAlign(x64emu_t* emu, const char* fmt, uint64_t* st, uint64_t* mystac
     int state = 0;
     #ifndef HAVE_LD80BITS
     double d;
+    long double ld;
     #endif
     int x = 0;
     while(*p)
@@ -89,6 +90,7 @@ void myStackAlign(x64emu_t* emu, const char* fmt, uint64_t* st, uint64_t* mystac
                 if(xmm) {
                     *mystack = emu->xmm[x++].q[0];
                     --xmm;
+                    mystack++;
                 } else {
                     *mystack = *st;
                     st++; mystack++;
@@ -101,10 +103,11 @@ void myStackAlign(x64emu_t* emu, const char* fmt, uint64_t* st, uint64_t* mystac
                 memcpy(mystack, st, 16);
                 st+=2; mystack+=2;
                 #else
-                // there is no long double on ARM, so tranform that in a regular double
+                // there is 128bits long double on ARM64
                 LD2D((void*)st, &d);
-                *mystack = *(uint64_t*)&d;
-                st+=2; mystack+=1;
+                ld = d ;
+                memcpy(mystack, &ld, 16);
+                st+=2; mystack+=2;
                 #endif
                 state = 0;
                 ++p;