]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Fix ESP/RSP stack pointer manipulation in more functions (x86-64)
authorFrode Solheim <frode@fs-uae.net>
Thu, 24 Sep 2015 18:19:40 +0000 (20:19 +0200)
committerFrode Solheim <frode@fs-uae.net>
Thu, 24 Sep 2015 18:24:22 +0000 (20:24 +0200)
jit/codegen_x86.cpp

index 2637c6ab34f526bcd3ab335f9b7dc4005bf6dd24..5b824e0234f93d616046b4c0d82470d58dce7539 100644 (file)
@@ -4733,9 +4733,16 @@ LOWFUNC(NONE,NONE,2,raw_ftan_rr,(FW d, FR s))
 }
 LENDFUNC(NONE,NONE,2,raw_ftan_rr,(FW d, FR s))
 
+#ifdef CPU_x86_64
+#define REX64 emit_byte(0x48);
+#else
+#define REX64
+#endif
+
 LOWFUNC(NONE,NONE,1,raw_fcuts_r,(FRW r))
 {
        make_tos(r);     /* TOS = r */
+       REX64
        emit_byte(0x83);
        emit_byte(0xc4);
        emit_byte(0xfc); /* add -4 to esp */
@@ -4746,6 +4753,7 @@ LOWFUNC(NONE,NONE,1,raw_fcuts_r,(FRW r))
        emit_byte(0x04);
        emit_byte(0x24); /* fld load r as SINGLE from [esp] */
        emit_byte(0x9b); /* let the CPU wait on FPU exceptions */
+       REX64
        emit_byte(0x83);
        emit_byte(0xc4);
        emit_byte(0x04); /* add +4 to esp */
@@ -4755,6 +4763,7 @@ LENDFUNC(NONE,NONE,1,raw_fcuts_r,(FRW r))
 LOWFUNC(NONE,NONE,1,raw_fcut_r,(FRW r))
 {
        make_tos(r);     /* TOS = r */
+       REX64
        emit_byte(0x83);
        emit_byte(0xc4);
        emit_byte(0xf8); /* add -8 to esp */
@@ -4765,6 +4774,7 @@ LOWFUNC(NONE,NONE,1,raw_fcut_r,(FRW r))
        emit_byte(0x04);
        emit_byte(0x24); /* fld load r as DOUBLE from [esp] */
        emit_byte(0x9b); /* let the CPU wait on FPU exceptions */
+       REX64
        emit_byte(0x83);
        emit_byte(0xc4);
        emit_byte(0x08); /* add +8 to esp */
@@ -5016,9 +5026,7 @@ LOWFUNC(NONE,NONE,2,raw_fsinh_rr,(FW d, FR s))
        if (tr>=0) {
                emit_byte(0xd9);
                emit_byte(0xca); /* fxch swap with temp-reg */
-#ifdef CPU_x86_64
-               emit_byte(0x48);  /* Use rsp register */
-#endif
+               REX64
                emit_byte(0x83);
                emit_byte(0xc4);
                emit_byte(0xf4); /* add -12 to esp */
@@ -5066,9 +5074,7 @@ LOWFUNC(NONE,NONE,2,raw_fsinh_rr,(FW d, FR s))
                emit_byte(0xca); /* fxch swap temp-reg with e^-x in tr */
                emit_byte(0xde);
                emit_byte(0xe9); /* fsubp (e^x)-(e^-x) */
-#ifdef CPU_x86_64
-               emit_byte(0x48); /* Use rsp register */
-#endif
+               REX64
                emit_byte(0x83);
                emit_byte(0xc4);
                emit_byte(0x0c); /* delayed add +12 to esp */
@@ -5113,6 +5119,7 @@ LOWFUNC(NONE,NONE,2,raw_fcosh_rr,(FW d, FR s))
        if (tr>=0) {
                emit_byte(0xd9);
                emit_byte(0xca); /* fxch swap with temp-reg */
+               REX64
                emit_byte(0x83);
                emit_byte(0xc4);
                emit_byte(0xf4); /* add -12 to esp */
@@ -5158,6 +5165,7 @@ LOWFUNC(NONE,NONE,2,raw_fcosh_rr,(FW d, FR s))
                emit_byte(0x24); /* fld load temp-reg from [esp] */
                emit_byte(0xd9);
                emit_byte(0xca); /* fxch swap temp-reg with e^-x in tr */
+               REX64
                emit_byte(0x83);
                emit_byte(0xc4);
                emit_byte(0x0c); /* delayed add +12 to esp */
@@ -5200,6 +5208,7 @@ LOWFUNC(NONE,NONE,2,raw_ftanh_rr,(FW d, FR s))
        if (tr>=0) {
                emit_byte(0xd9);
                emit_byte(0xca); /* fxch swap with temp-reg */
+               REX64
                emit_byte(0x83);
                emit_byte(0xc4);
                emit_byte(0xf4); /* add -12 to esp */
@@ -5253,6 +5262,7 @@ LOWFUNC(NONE,NONE,2,raw_ftanh_rr,(FW d, FR s))
                emit_byte(0xca); /* fxch swap temp-reg with e^-x in tr */
                emit_byte(0xde);
                emit_byte(0xf9); /* fdivp ((e^x)-(e^-x))/((e^x)+(e^-x)) */
+               REX64
                emit_byte(0x83);
                emit_byte(0xc4);
                emit_byte(0x0c); /* delayed add +12 to esp */