From 9b9641c6d92c5222a2ad457273cdb9a3b32ecaa3 Mon Sep 17 00:00:00 2001 From: gikidy Date: Wed, 10 Jun 2009 07:14:17 +0000 Subject: Save/Restore xmm6-xmm15 in function setJump/longJump. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8506 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Include/Library/BaseLib.h | 2 ++ MdePkg/Library/BaseLib/X64/LongJump.asm | 14 +++++++++++++- MdePkg/Library/BaseLib/X64/SetJump.asm | 12 ++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h index 32887b1..25d61f1 100644 --- a/MdePkg/Include/Library/BaseLib.h +++ b/MdePkg/Include/Library/BaseLib.h @@ -101,6 +101,8 @@ typedef struct { UINT64 R14; UINT64 R15; UINT64 Rip; + UINT64 MxCsr; + UINT8 XmmBuffer[160]; ///< XMM6-XMM15 } BASE_LIBRARY_JUMP_BUFFER; #define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 8 diff --git a/MdePkg/Library/BaseLib/X64/LongJump.asm b/MdePkg/Library/BaseLib/X64/LongJump.asm index 38e5606..2b63fab 100644 --- a/MdePkg/Library/BaseLib/X64/LongJump.asm +++ b/MdePkg/Library/BaseLib/X64/LongJump.asm @@ -39,7 +39,19 @@ InternalLongJump PROC mov r13, [rcx + 30h] mov r14, [rcx + 38h] mov r15, [rcx + 40h] - mov rax, rdx ; set return value + ; load non-volatile fp registers + ldmxcsr [rcx + 50h] + movdqu xmm6, [rcx + 58h] + movdqu xmm7, [rcx + 68h] + movdqu xmm8, [rcx + 78h] + movdqu xmm9, [rcx + 88h] + movdqu xmm10, [rcx + 98h] + movdqu xmm11, [rcx + 0A8h] + movdqu xmm12, [rcx + 0B8h] + movdqu xmm13, [rcx + 0C8h] + movdqu xmm14, [rcx + 0D8h] + movdqu xmm15, [rcx + 0E8h] + mov rax, rdx ; set return value jmp qword ptr [rcx + 48h] InternalLongJump ENDP diff --git a/MdePkg/Library/BaseLib/X64/SetJump.asm b/MdePkg/Library/BaseLib/X64/SetJump.asm index 2ed581e..5ef8de3 100644 --- a/MdePkg/Library/BaseLib/X64/SetJump.asm +++ b/MdePkg/Library/BaseLib/X64/SetJump.asm @@ -47,6 +47,18 @@ SetJump PROC mov [rcx + 38h], r14 mov [rcx + 40h], r15 mov [rcx + 48h], rdx + ; save non-volatile fp registers + stmxcsr [rcx + 50h] + movdqu [rcx + 58h], xmm6 + movdqu [rcx + 68h], xmm7 + movdqu [rcx + 78h], xmm8 + movdqu [rcx + 88h], xmm9 + movdqu [rcx + 98h], xmm10 + movdqu [rcx + 0A8h], xmm11 + movdqu [rcx + 0B8h], xmm12 + movdqu [rcx + 0C8h], xmm13 + movdqu [rcx + 0D8h], xmm14 + movdqu [rcx + 0E8h], xmm15 xor rax, rax jmp rdx SetJump ENDP -- cgit v1.1