]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseLib/Ipf/setjmp.s
1. Port X64, IPF and EBC arch for BaseLib
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ipf / setjmp.s
diff --git a/MdePkg/Library/BaseLib/Ipf/setjmp.s b/MdePkg/Library/BaseLib/Ipf/setjmp.s
new file mode 100644 (file)
index 0000000..e2b346e
--- /dev/null
@@ -0,0 +1,108 @@
+/// @file\r
+///  Contains an implementation of longjmp for the Itanium-based architecture.\r
+///\r
+/// Copyright (c) 2006, Intel Corporation\r
+/// All rights reserved. This program and the accompanying materials\r
+/// are licensed and made available under the terms and conditions of the BSD License\r
+/// which accompanies this distribution.  The full text of the license may be found at\r
+/// http://opensource.org/licenses/bsd-license.php\r
+///\r
+/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+///\r
+/// Module Name: longjmp.s\r
+///\r
+///\r
+\r
+.auto\r
+.text\r
+\r
+.globl InternalAssertJumpBuffer\r
+.type   InternalAssertJumpBuffer, @function\r
+\r
+.proc   SetJump\r
+.type   SetJump, @function\r
+SetJump::\r
+        alloc               loc0 = ar.pfs, 1, 2, 1, 0\r
+        mov                 loc1 = b0\r
+        mov                 out0 = in0\r
+\r
+        brl.call.sptk.many  b0  = InternalAssertJumpBuffer\r
+\r
+        mov                 r14 = ar.unat\r
+        mov                 r15 = ar.bsp\r
+        add                 r10 = 0x10*20, in0\r
+\r
+        stf.spill.nta       [in0] = f2, 0x10\r
+        st8.spill.nta       [r10] = r4, 8\r
+        mov                 r21 = b1\r
+\r
+        stf.spill.nta       [in0] = f3, 0x10\r
+        st8.spill.nta       [r10] = r5, 8\r
+        mov                 r22 = b2\r
+\r
+        stf.spill.nta       [in0] = f4, 0x10\r
+        st8.spill.nta       [r10] = r6, 8\r
+        mov                 r23 = b3\r
+\r
+        stf.spill.nta       [in0] = f5, 0x10\r
+        st8.spill.nta       [r10] = r7, 8\r
+        mov                 r24 = b4\r
+\r
+        stf.spill.nta       [in0] = f16, 0x10\r
+        st8.spill.nta       [r10] = sp, 8\r
+        mov                 r25 = b5\r
+\r
+        stf.spill.nta       [in0] = f17, 0x10\r
+        st8.nta             [r10] = loc1, 8\r
+        mov                 r16 = pr\r
+\r
+        stf.spill.nta       [in0] = f18, 0x10\r
+        st8.nta             [r10] = r21, 8\r
+        mov                 r17 = ar.lc\r
+\r
+        stf.spill.nta       [in0] = f19, 0x10\r
+        st8.nta             [r10] = r22, 8\r
+\r
+        stf.spill.nta       [in0] = f20, 0x10\r
+        st8.nta             [r10] = r23, 8\r
+\r
+        stf.spill.nta       [in0] = f21, 0x10\r
+        st8.nta             [r10] = r24, 8\r
+\r
+        stf.spill.nta       [in0] = f22, 0x10\r
+        st8.nta             [r10] = r25, 8\r
+\r
+        stf.spill.nta       [in0] = f23, 0x10\r
+        mov                 r18 = ar.unat\r
+\r
+        stf.spill.nta       [in0] = f24, 0x10\r
+        st8.nta             [r10] = r14, 8          // UNAT\r
+\r
+        stf.spill.nta       [in0] = f25, 0x10\r
+        st8.nta             [r10] = r18, 8          // UNAT after spill\r
+\r
+        stf.spill.nta       [in0] = f26, 0x10\r
+        st8.nta             [r10] = loc0, 8         // PFS\r
+\r
+        stf.spill.nta       [in0] = f27, 0x10\r
+        st8.nta             [r10] = r15, 8          // BSP\r
+        mov                 r8  = 0\r
+\r
+        stf.spill.nta       [in0] = f28, 0x10\r
+        mov                 r19 = ar.fpsr\r
+\r
+        stf.spill.nta       [in0] = f29, 0x10\r
+        st8.nta             [r10] = r16, 8          // PR\r
+        mov                 ar.pfs = loc0\r
+\r
+        stf.spill.nta       [in0] = f30, 0x10\r
+        st8.nta             [r10] = r17, 8          // LC\r
+        mov                 b0  = loc1\r
+\r
+        stf.spill.nta       [in0] = f31, 0x10\r
+        st8.nta             [r10] = r19             // FPSR\r
+\r
+        mov                 ar.unat = r14\r
+        br.ret.sptk         b0\r
+.endp   SetJump\r