stack_operations.py (7872:b21a94bf6a28) | stack_operations.py (11829:cb5390385d87) |
---|---|
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 --- 26 unchanged lines hidden (view full) --- 35# 36# Authors: Gabe Black 37 38microcode = ''' 39def macroop POP_R { 40 # Make the default data size of pops 64 bits in 64 bit mode 41 .adjust_env oszIn64Override 42 | 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 --- 26 unchanged lines hidden (view full) --- 35# 36# Authors: Gabe Black 37 38microcode = ''' 39def macroop POP_R { 40 # Make the default data size of pops 64 bits in 64 bit mode 41 .adjust_env oszIn64Override 42 |
43 ld t1, ss, [1, t0, rsp], dataSize=ssz | 43 ldis t1, ss, [1, t0, rsp], dataSize=ssz |
44 addi rsp, rsp, ssz, dataSize=asz 45 mov reg, reg, t1 46}; 47 48def macroop POP_M { 49 # Make the default data size of pops 64 bits in 64 bit mode 50 .adjust_env oszIn64Override 51 | 44 addi rsp, rsp, ssz, dataSize=asz 45 mov reg, reg, t1 46}; 47 48def macroop POP_M { 49 # Make the default data size of pops 64 bits in 64 bit mode 50 .adjust_env oszIn64Override 51 |
52 ld t1, ss, [1, t0, rsp], dataSize=ssz | 52 ldis t1, ss, [1, t0, rsp], dataSize=ssz |
53 cda seg, sib, disp, dataSize=ssz 54 addi rsp, rsp, ssz, dataSize=asz 55 st t1, seg, sib, disp, dataSize=ssz 56}; 57 58def macroop POP_P { 59 # Make the default data size of pops 64 bits in 64 bit mode 60 .adjust_env oszIn64Override --- 4 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 | 53 cda seg, sib, disp, dataSize=ssz 54 addi rsp, rsp, ssz, dataSize=asz 55 st t1, seg, sib, disp, dataSize=ssz 56}; 57 58def macroop POP_P { 59 # Make the default data size of pops 64 bits in 64 bit mode 60 .adjust_env oszIn64Override --- 4 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 st reg, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz | 73 stis reg, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz |
74 subi rsp, rsp, ssz 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 | 74 subi rsp, rsp, ssz 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 |
82 st t1, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz | 82 stis t1, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz |
83 subi rsp, rsp, 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 --- 42 unchanged lines hidden (view full) --- 133 addi rsp, rsp, "8 * env.stackSize", dataSize=asz 134}; 135 136def macroop LEAVE { 137 # Make the default data size of pops 64 bits in 64 bit mode 138 .adjust_env oszIn64Override 139 140 mov t1, t1, rbp, dataSize=ssz | 83 subi rsp, rsp, 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 --- 42 unchanged lines hidden (view full) --- 133 addi rsp, rsp, "8 * env.stackSize", dataSize=asz 134}; 135 136def macroop LEAVE { 137 # Make the default data size of pops 64 bits in 64 bit mode 138 .adjust_env oszIn64Override 139 140 mov t1, t1, rbp, dataSize=ssz |
141 ld rbp, ss, [1, t0, t1], dataSize=ssz | 141 ldis rbp, ss, [1, t0, t1], dataSize=ssz |
142 mov rsp, rsp, t1, dataSize=ssz 143 addi rsp, rsp, ssz, dataSize=ssz 144}; 145 146def macroop ENTER_I_I { 147 .adjust_env oszIn64Override 148 # This needs to check all the addresses it writes to before it actually 149 # writes any values. 150 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. | 142 mov rsp, rsp, t1, dataSize=ssz 143 addi rsp, rsp, ssz, dataSize=ssz 144}; 145 146def macroop ENTER_I_I { 147 .adjust_env oszIn64Override 148 # This needs to check all the addresses it writes to before it actually 149 # writes any values. 150 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. |
159 st rbp, ss, [1, t0, rsp], "-env.dataSize" | 159 stis rbp, ss, [1, t0, rsp], "-env.dataSize" |
160 subi rsp, rsp, ssz 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: | 160 subi rsp, rsp, ssz 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] 176 st t5, ss, [1, t0, rsp], "-env.dataSize" | 175 ldis t5, ss, [dsz, t4, rbp] 176 stis t5, ss, [1, t0, rsp], "-env.dataSize" |
177 subi rsp, rsp, ssz 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 | 177 subi rsp, rsp, ssz 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 |
186 st t6, ss, [1, t0, rsp], "-env.dataSize" | 186 stis t6, ss, [1, t0, rsp], "-env.dataSize" |
187 subi rsp, rsp, ssz 188 189skipLoop: 190 sub rsp, rsp, t2, dataSize=ssz 191 mov rbp, rbp, t6 192}; 193''' | 187 subi rsp, rsp, ssz 188 189skipLoop: 190 sub rsp, rsp, t2, dataSize=ssz 191 mov rbp, rbp, t6 192}; 193''' |