stack_operations.py (6344:b7104eda0795) stack_operations.py (6475:951199885fd8)
1# Copyright (c) 2007-2008 The Hewlett-Packard Development Company
2# All rights reserved.
3#
4# Redistribution and use of this software in source and binary forms,
5# with or without modification, are permitted provided that the
6# following conditions are met:
7#
8# The software must be used only for Non-Commercial Use which means any

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

145 mov rax, rax, t2, dataSize=ssz
146 addi rsp, rsp, "8 * env.stackSize", dataSize=asz
147};
148
149def macroop LEAVE {
150 # Make the default data size of pops 64 bits in 64 bit mode
151 .adjust_env oszIn64Override
152
1# Copyright (c) 2007-2008 The Hewlett-Packard Development Company
2# All rights reserved.
3#
4# Redistribution and use of this software in source and binary forms,
5# with or without modification, are permitted provided that the
6# following conditions are met:
7#
8# The software must be used only for Non-Commercial Use which means any

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

145 mov rax, rax, t2, dataSize=ssz
146 addi rsp, rsp, "8 * env.stackSize", dataSize=asz
147};
148
149def macroop LEAVE {
150 # Make the default data size of pops 64 bits in 64 bit mode
151 .adjust_env oszIn64Override
152
153 mov t1, t1, rbp, dataSize=asz
153 mov t1, t1, rbp, dataSize=ssz
154 ld rbp, ss, [1, t0, t1], dataSize=ssz
154 ld rbp, ss, [1, t0, t1], dataSize=ssz
155 mov rsp, rsp, t1, dataSize=asz
156 addi rsp, rsp, ssz, dataSize=asz
155 mov rsp, rsp, t1, dataSize=ssz
156 addi rsp, rsp, ssz, dataSize=ssz
157};
158
159def macroop ENTER_I_I {
157};
158
159def macroop ENTER_I_I {
160 .adjust_env oszIn64Override
160 # This needs to check all the addresses it writes to before it actually
161 # writes any values.
162
163 # Pull the different components out of the immediate
164 limm t1, imm
165 zexti t2, t1, 15, dataSize=8
166 srli t1, t1, 16
167 zexti t1, t1, 5, dataSize=8
168 # t1 is now the masked nesting level, and t2 is the amount of storage.
169
170 # Push rbp.
161 # This needs to check all the addresses it writes to before it actually
162 # writes any values.
163
164 # Pull the different components out of the immediate
165 limm t1, imm
166 zexti t2, t1, 15, dataSize=8
167 srli t1, t1, 16
168 zexti t1, t1, 5, dataSize=8
169 # t1 is now the masked nesting level, and t2 is the amount of storage.
170
171 # Push rbp.
171 stupd rbp, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz
172 stupd rbp, ss, [1, t0, rsp], "-env.dataSize"
172
173 # Save the stack pointer for later
173
174 # Save the stack pointer for later
174 mov t6, t6, rsp, dataSize=asz
175 mov t6, t6, rsp
175
176 # If the nesting level is zero, skip all this stuff.
177 sub t0, t1, t0, flags=(EZF,), dataSize=2
178 br label("skipLoop"), flags=(CEZF,)
179
180 # If the level was 1, only push the saved rbp
181 subi t0, t1, 1, flags=(EZF,)
182 br label("bottomOfLoop"), flags=(CEZF,)
183
184 limm t4, "ULL(-1)", dataSize=8
185topOfLoop:
176
177 # If the nesting level is zero, skip all this stuff.
178 sub t0, t1, t0, flags=(EZF,), dataSize=2
179 br label("skipLoop"), flags=(CEZF,)
180
181 # If the level was 1, only push the saved rbp
182 subi t0, t1, 1, flags=(EZF,)
183 br label("bottomOfLoop"), flags=(CEZF,)
184
185 limm t4, "ULL(-1)", dataSize=8
186topOfLoop:
186 ld t5, ss, [ssz, t4, rbp], dataSize=ssz
187 stupd t5, ss, [1, t0, rsp], "-env.stackSize"
187 ld t5, ss, [dsz, t4, rbp]
188 stupd t5, ss, [1, t0, rsp], "-env.dataSize"
188
189 # If we're not done yet, loop
190 subi t4, t4, 1, dataSize=8
191 add t0, t4, t1, flags=(EZF,)
192 br label("topOfLoop"), flags=(nCEZF,)
193
194bottomOfLoop:
195 # Push the old rbp onto the stack
189
190 # If we're not done yet, loop
191 subi t4, t4, 1, dataSize=8
192 add t0, t4, t1, flags=(EZF,)
193 br label("topOfLoop"), flags=(nCEZF,)
194
195bottomOfLoop:
196 # Push the old rbp onto the stack
196 stupd t6, ss, [1, t0, rsp], "-env.stackSize"
197 stupd t6, ss, [1, t0, rsp], "-env.dataSize"
197
198skipLoop:
198
199skipLoop:
199 sub rsp, rsp, t2, dataSize=asz
200 mov rbp, rbp, t6, dataSize=asz
200 sub rsp, rsp, t2, dataSize=ssz
201 mov rbp, rbp, t6
201};
202'''
202};
203'''