summaryrefslogtreecommitdiffstats
path: root/src/ssx/ppc32/savegpr.S
blob: 854f22b1d41fe86258bddeb7e3fd5e821c29c3f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// $Id: savegpr.S,v 1.1.1.1 2013/12/11 21:03:25 bcbrock Exp $
// $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/chips/p8/working/procedures/ssx/ppc32/savegpr.S,v $
//-----------------------------------------------------------------------------
// *! (C) Copyright International Business Machines Corp. 2013
// *! All Rights Reserved -- Property of IBM
// *! *** IBM Confidential ***
//-----------------------------------------------------------------------------

///
/// \file savegpr.S
/// \brief Push registers onto or load registers from the stack 
///
/// This code was developed due to missing references to _savegpr_{X}
/// and _restgpr_{X}_x that surfaced when moving to GCC 4.5.1 and 
/// using the -Os optimization level.
/// 
/// The open-source code was viewed to get the spec, but no 
/// code was copied.
///


        .macro SAVE reg
                .global _savegpr_\reg
        _savegpr_\reg\(): 
                stw \reg,(((31-\reg)*4 +4)*-1)(11)
        .endm

        SAVE 14
        SAVE 15
        SAVE 16
        SAVE 17
        SAVE 18
        SAVE 19
        SAVE 20
        SAVE 21
        SAVE 22
        SAVE 23
        SAVE 24
        SAVE 25
        SAVE 26
        SAVE 27
        SAVE 28
        SAVE 29
        SAVE 30
        SAVE 31
        blr
        
        .macro RESTX reg
                .global _restgpr_\reg\()_x
        _restgpr_\reg\()_x: 
                .ifeq (31-\reg)
                        lwz 0,4(11)
                .endif
                lwz \reg,(((31-\reg)*4 +4)*-1)(11)
                        
        .endm
        
        RESTX 14
        RESTX 15
        RESTX 16
        RESTX 17
        RESTX 18
        RESTX 19
        RESTX 20
        RESTX 21
        RESTX 22
        RESTX 23
        RESTX 24
        RESTX 25
        RESTX 26
        RESTX 27
        RESTX 28
        RESTX 29
        RESTX 30
        RESTX 31
        mtlr 0
        mr 1,11
        blr
OpenPOWER on IntegriCloud