1/// @file
2///  IPF specific SwitchStack() function
3///
4/// Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
5/// This program and the accompanying materials
6/// are licensed and made available under the terms and conditions of the BSD License
7/// which accompanies this distribution.  The full text of the license may be found at
8/// http://opensource.org/licenses/bsd-license.php.
9///
10/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12///
13/// Module Name: SwitchStack.s
14///
15///
16
17.auto
18.text
19
20.proc   AsmSwitchStackAndBackingStore
21.type   AsmSwitchStackAndBackingStore, @function
22.regstk 5, 0, 0, 0
23AsmSwitchStackAndBackingStore::
24        mov                 r14 = ar.rsc
25        movl                r2  = ~((((1 << 14) - 1) << 16) | 3)
26
27        mov                 r17 = in1
28        mov                 r18 = in2
29        and                 r2  = r14, r2
30
31        flushrs
32
33        mov                 ar.rsc = r2
34        mov                 sp  = in3
35        mov                 r19 = in4
36
37        ld8.nt1             r16 = [in0], 8
38        ld8.nta             gp  = [in0]
39        mov                 r3  = -1
40
41        loadrs
42        mov                 ar.bspstore = r19
43        mov                 b7  = r16
44
45        alloc               r2  = ar.pfs, 0, 0, 2, 0
46        mov                 out0 = r17
47        mov                 out1 = r18
48
49        mov                 ar.rnat = r3
50        mov                 ar.rsc = r14
51        br.call.sptk.many   b0  = b7
52.endp   AsmSwitchStackAndBackingStore
53