[PATCH] msvcrt: Back up and restore the FPU state in setjmp/longjmp on arm

Martin Storsjo <[email protected]>
Newsgroups gmane.comp.emulators.wine.patches
Message-ID <[email protected]>
Signed-off-by: Martin Storsjo <[email protected]>
---
Reposting this one now that we can assume support for VFP in
ARM build configurations.
---
 dlls/msvcrt/except_arm.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcrt/except_arm.c b/dlls/msvcrt/except_arm.c
index 29ddb7b..76c4735 100644
--- a/dlls/msvcrt/except_arm.c
+++ b/dlls/msvcrt/except_arm.c
@@ -151,7 +151,16 @@ __ASM_GLOBAL_FUNC(MSVCRT__setjmpex,
                   "str r11, [r0, #0x20]\n\t"      /* jmp_buf->R11 */
                   "str sp, [r0, #0x24]\n\t"       /* jmp_buf->Sp */
                   "str lr, [r0, #0x28]\n\t"       /* jmp_buf->Pc */
-                  /* FIXME: Save floating point data */
+                  "vmrs r2, fpscr\n\t"
+                  "str r2, [r0, #0x2c]\n\t"       /* jmp_buf->Fpscr */
+                  "vstr d8,  [r0, #0x30]\n\t"     /* jmp_buf->D[0] */
+                  "vstr d9,  [r0, #0x38]\n\t"     /* jmp_buf->D[1] */
+                  "vstr d10, [r0, #0x40]\n\t"     /* jmp_buf->D[2] */
+                  "vstr d11, [r0, #0x48]\n\t"     /* jmp_buf->D[3] */
+                  "vstr d12, [r0, #0x50]\n\t"     /* jmp_buf->D[4] */
+                  "vstr d13, [r0, #0x58]\n\t"     /* jmp_buf->D[5] */
+                  "vstr d14, [r0, #0x60]\n\t"     /* jmp_buf->D[6] */
+                  "vstr d15, [r0, #0x68]\n\t"     /* jmp_buf->D[7] */
                   "mov r0, #0\n\t"
                   "bx lr");
 
@@ -168,7 +177,16 @@ __ASM_GLOBAL_FUNC(longjmp_set_regs,
                   "ldr r11, [r0, #0x20]\n\t"      /* jmp_buf->R11 */
                   "ldr sp, [r0, #0x24]\n\t"       /* jmp_buf->Sp */
                   "ldr r2, [r0, #0x28]\n\t"       /* jmp_buf->Pc */
-                  /* FIXME: Restore floating point data */
+                  "ldr r3, [r0, #0x2c]\n\t"       /* jmp_buf->Fpscr */
+                  "vmsr fpscr, r3\n\t"
+                  "vldr d8,  [r0, #0x30]\n\t"     /* jmp_buf->D[0] */
+                  "vldr d9,  [r0, #0x38]\n\t"     /* jmp_buf->D[1] */
+                  "vldr d10, [r0, #0x40]\n\t"     /* jmp_buf->D[2] */
+                  "vldr d11, [r0, #0x48]\n\t"     /* jmp_buf->D[3] */
+                  "vldr d12, [r0, #0x50]\n\t"     /* jmp_buf->D[4] */
+                  "vldr d13, [r0, #0x58]\n\t"     /* jmp_buf->D[5] */
+                  "vldr d14, [r0, #0x60]\n\t"     /* jmp_buf->D[6] */
+                  "vldr d15, [r0, #0x68]\n\t"     /* jmp_buf->D[7] */
                   "mov r0, r1\n\t"                /* retval */
                   "bx r2");
 
-- 
2.7.4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.