stack_operations.py (7087:fb8d5786ff30) stack_operations.py (7872:b21a94bf6a28)
1# Copyright (c) 2007-2008 The Hewlett-Packard Development Company
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

--- 56 unchanged lines hidden (view full) ---

65 addi rsp, rsp, ssz, dataSize=asz
66 st t1, seg, riprel, disp, dataSize=ssz
67};
68
69def macroop PUSH_R {
70 # Make the default data size of pops 64 bits in 64 bit mode
71 .adjust_env oszIn64Override
72
1# Copyright (c) 2007-2008 The Hewlett-Packard Development Company
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

--- 56 unchanged lines hidden (view full) ---

65 addi rsp, rsp, ssz, dataSize=asz
66 st t1, seg, riprel, disp, dataSize=ssz
67};
68
69def macroop PUSH_R {
70 # Make the default data size of pops 64 bits in 64 bit mode
71 .adjust_env oszIn64Override
72
73 stupd reg, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz
73 st reg, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz
74 subi rsp, rsp, ssz
74};
75
76def macroop PUSH_I {
77 # Make the default data size of pops 64 bits in 64 bit mode
78 .adjust_env oszIn64Override
79
80 limm t1, imm
75};
76
77def macroop PUSH_I {
78 # Make the default data size of pops 64 bits in 64 bit mode
79 .adjust_env oszIn64Override
80
81 limm t1, imm
81 stupd t1, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz
82 st t1, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz
83 subi rsp, rsp, ssz
82};
83
84def macroop PUSH_M {
85 # Make the default data size of pops 64 bits in 64 bit mode
86 .adjust_env oszIn64Override
87
88 ld t1, seg, sib, disp, dataSize=ssz
84};
85
86def macroop PUSH_M {
87 # Make the default data size of pops 64 bits in 64 bit mode
88 .adjust_env oszIn64Override
89
90 ld t1, seg, sib, disp, dataSize=ssz
89 stupd t1, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz
91 st t1, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz
92 subi rsp, rsp, ssz
90};
91
92def macroop PUSH_P {
93 # Make the default data size of pops 64 bits in 64 bit mode
94 .adjust_env oszIn64Override
95
96 rdip t7
97 ld t1, seg, riprel, disp, dataSize=ssz
93};
94
95def macroop PUSH_P {
96 # Make the default data size of pops 64 bits in 64 bit mode
97 .adjust_env oszIn64Override
98
99 rdip t7
100 ld t1, seg, riprel, disp, dataSize=ssz
98 stupd t1, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz
101 st t1, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz
102 subi rsp, rsp, ssz
99};
100
101def macroop PUSHA {
102 # Check all the stack addresses. We'll assume that if the beginning and
103 # end are ok, then the stuff in the middle should be as well.
104 cda ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz
105 cda ss, [1, t0, rsp], "-8 * env.stackSize", dataSize=ssz
103};
104
105def macroop PUSHA {
106 # Check all the stack addresses. We'll assume that if the beginning and
107 # end are ok, then the stuff in the middle should be as well.
108 cda ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz
109 cda ss, [1, t0, rsp], "-8 * env.stackSize", dataSize=ssz
106 stupd rax, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz
107 stupd rcx, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz
108 stupd rdx, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz
109 stupd rbx, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz
110 stupd rsp, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz
111 stupd rbp, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz
112 stupd rsi, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz
113 stupd rdi, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz
110 st rax, ss, [1, t0, rsp], "1 * -env.stackSize", dataSize=ssz
111 st rcx, ss, [1, t0, rsp], "2 * -env.stackSize", dataSize=ssz
112 st rdx, ss, [1, t0, rsp], "3 * -env.stackSize", dataSize=ssz
113 st rbx, ss, [1, t0, rsp], "4 * -env.stackSize", dataSize=ssz
114 st rsp, ss, [1, t0, rsp], "5 * -env.stackSize", dataSize=ssz
115 st rbp, ss, [1, t0, rsp], "6 * -env.stackSize", dataSize=ssz
116 st rsi, ss, [1, t0, rsp], "7 * -env.stackSize", dataSize=ssz
117 st rdi, ss, [1, t0, rsp], "8 * -env.stackSize", dataSize=ssz
118 subi rsp, rsp, "8 * env.stackSize"
114};
115
116def macroop POPA {
117 # Check all the stack addresses. We'll assume that if the beginning and
118 # end are ok, then the stuff in the middle should be as well.
119 ld t1, ss, [1, t0, rsp], "0 * env.stackSize", dataSize=ssz
120 ld t2, ss, [1, t0, rsp], "7 * env.stackSize", dataSize=ssz
121 mov rdi, rdi, t1, dataSize=ssz

--- 24 unchanged lines hidden (view full) ---

146 # Pull the different components out of the immediate
147 limm t1, imm, dataSize=8
148 zexti t2, t1, 15, dataSize=8
149 srli t1, t1, 16, dataSize=8
150 zexti t1, t1, 5, dataSize=8
151 # t1 is now the masked nesting level, and t2 is the amount of storage.
152
153 # Push rbp.
119};
120
121def macroop POPA {
122 # Check all the stack addresses. We'll assume that if the beginning and
123 # end are ok, then the stuff in the middle should be as well.
124 ld t1, ss, [1, t0, rsp], "0 * env.stackSize", dataSize=ssz
125 ld t2, ss, [1, t0, rsp], "7 * env.stackSize", dataSize=ssz
126 mov rdi, rdi, t1, dataSize=ssz

--- 24 unchanged lines hidden (view full) ---

151 # Pull the different components out of the immediate
152 limm t1, imm, dataSize=8
153 zexti t2, t1, 15, dataSize=8
154 srli t1, t1, 16, dataSize=8
155 zexti t1, t1, 5, dataSize=8
156 # t1 is now the masked nesting level, and t2 is the amount of storage.
157
158 # Push rbp.
154 stupd rbp, ss, [1, t0, rsp], "-env.dataSize"
159 st rbp, ss, [1, t0, rsp], "-env.dataSize"
160 subi rsp, rsp, ssz
155
156 # Save the stack pointer for later
157 mov t6, t6, rsp
158
159 # If the nesting level is zero, skip all this stuff.
160 sub t0, t1, t0, flags=(EZF,), dataSize=2
161 br label("skipLoop"), flags=(CEZF,)
162
163 # If the level was 1, only push the saved rbp
164 subi t0, t1, 1, flags=(EZF,)
165 br label("bottomOfLoop"), flags=(CEZF,)
166
167 limm t4, "ULL(-1)", dataSize=8
168topOfLoop:
169 ld t5, ss, [dsz, t4, rbp]
161
162 # Save the stack pointer for later
163 mov t6, t6, rsp
164
165 # If the nesting level is zero, skip all this stuff.
166 sub t0, t1, t0, flags=(EZF,), dataSize=2
167 br label("skipLoop"), flags=(CEZF,)
168
169 # If the level was 1, only push the saved rbp
170 subi t0, t1, 1, flags=(EZF,)
171 br label("bottomOfLoop"), flags=(CEZF,)
172
173 limm t4, "ULL(-1)", dataSize=8
174topOfLoop:
175 ld t5, ss, [dsz, t4, rbp]
170 stupd t5, ss, [1, t0, rsp], "-env.dataSize"
176 st t5, ss, [1, t0, rsp], "-env.dataSize"
177 subi rsp, rsp, ssz
171
172 # If we're not done yet, loop
173 subi t4, t4, 1, dataSize=8
174 add t0, t4, t1, flags=(EZF,)
175 br label("topOfLoop"), flags=(nCEZF,)
176
177bottomOfLoop:
178 # Push the old rbp onto the stack
178
179 # If we're not done yet, loop
180 subi t4, t4, 1, dataSize=8
181 add t0, t4, t1, flags=(EZF,)
182 br label("topOfLoop"), flags=(nCEZF,)
183
184bottomOfLoop:
185 # Push the old rbp onto the stack
179 stupd t6, ss, [1, t0, rsp], "-env.dataSize"
186 st t6, ss, [1, t0, rsp], "-env.dataSize"
187 subi rsp, rsp, ssz
180
181skipLoop:
182 sub rsp, rsp, t2, dataSize=ssz
183 mov rbp, rbp, t6
184};
185'''
188
189skipLoop:
190 sub rsp, rsp, t2, dataSize=ssz
191 mov rbp, rbp, t6
192};
193'''