From eabbdbee63798bda4f549c745e6f35989bef8b30 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 2 Feb 2011 19:56:38 -0800 Subject: [PATCH] X86: Replace the stupd microop with a store/update sequence. --- .../general_purpose/control_transfer/call.py | 12 ++++-- .../data_transfer/stack_operations.py | 38 +++++++++++-------- .../general_purpose/flags/push_and_pop.py | 3 +- 3 files changed, 33 insertions(+), 20 deletions(-) diff --git a/src/arch/x86/isa/insts/general_purpose/control_transfer/call.py b/src/arch/x86/isa/insts/general_purpose/control_transfer/call.py index 870788099..f18a062a6 100644 --- a/src/arch/x86/isa/insts/general_purpose/control_transfer/call.py +++ b/src/arch/x86/isa/insts/general_purpose/control_transfer/call.py @@ -44,7 +44,8 @@ def macroop CALL_NEAR_I limm t1, imm rdip t7 # Check target of call - stupd t7, ss, [0, t0, rsp], "-env.dataSize" + st t7, ss, [0, t0, rsp], "-env.dataSize" + subi rsp, rsp, ssz wrip t7, t1 }; @@ -55,7 +56,8 @@ def macroop CALL_NEAR_R rdip t1 # Check target of call - stupd t1, ss, [0, t0, rsp], "-env.dataSize" + st t1, ss, [0, t0, rsp], "-env.dataSize" + subi rsp, rsp, ssz wripi reg, 0 }; @@ -67,7 +69,8 @@ def macroop CALL_NEAR_M rdip t7 ld t1, seg, sib, disp # Check target of call - stupd t7, ss, [0, t0, rsp], "-env.dataSize" + st t7, ss, [0, t0, rsp], "-env.dataSize" + subi rsp, rsp, ssz wripi t1, 0 }; @@ -79,7 +82,8 @@ def macroop CALL_NEAR_P rdip t7 ld t1, seg, riprel, disp # Check target of call - stupd t7, ss, [0, t0, rsp], "-env.dataSize" + st t7, ss, [0, t0, rsp], "-env.dataSize" + subi rsp, rsp, ssz wripi t1, 0 }; ''' diff --git a/src/arch/x86/isa/insts/general_purpose/data_transfer/stack_operations.py b/src/arch/x86/isa/insts/general_purpose/data_transfer/stack_operations.py index c863d83e4..be9387ecf 100644 --- a/src/arch/x86/isa/insts/general_purpose/data_transfer/stack_operations.py +++ b/src/arch/x86/isa/insts/general_purpose/data_transfer/stack_operations.py @@ -70,7 +70,8 @@ def macroop PUSH_R { # Make the default data size of pops 64 bits in 64 bit mode .adjust_env oszIn64Override - stupd reg, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz + st reg, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz + subi rsp, rsp, ssz }; def macroop PUSH_I { @@ -78,7 +79,8 @@ def macroop PUSH_I { .adjust_env oszIn64Override limm t1, imm - stupd t1, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz + st t1, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz + subi rsp, rsp, ssz }; def macroop PUSH_M { @@ -86,7 +88,8 @@ def macroop PUSH_M { .adjust_env oszIn64Override ld t1, seg, sib, disp, dataSize=ssz - stupd t1, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz + st t1, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz + subi rsp, rsp, ssz }; def macroop PUSH_P { @@ -95,7 +98,8 @@ def macroop PUSH_P { rdip t7 ld t1, seg, riprel, disp, dataSize=ssz - stupd t1, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz + st t1, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz + subi rsp, rsp, ssz }; def macroop PUSHA { @@ -103,14 +107,15 @@ def macroop PUSHA { # end are ok, then the stuff in the middle should be as well. cda ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz cda ss, [1, t0, rsp], "-8 * env.stackSize", dataSize=ssz - stupd rax, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz - stupd rcx, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz - stupd rdx, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz - stupd rbx, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz - stupd rsp, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz - stupd rbp, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz - stupd rsi, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz - stupd rdi, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz + st rax, ss, [1, t0, rsp], "1 * -env.stackSize", dataSize=ssz + st rcx, ss, [1, t0, rsp], "2 * -env.stackSize", dataSize=ssz + st rdx, ss, [1, t0, rsp], "3 * -env.stackSize", dataSize=ssz + st rbx, ss, [1, t0, rsp], "4 * -env.stackSize", dataSize=ssz + st rsp, ss, [1, t0, rsp], "5 * -env.stackSize", dataSize=ssz + st rbp, ss, [1, t0, rsp], "6 * -env.stackSize", dataSize=ssz + st rsi, ss, [1, t0, rsp], "7 * -env.stackSize", dataSize=ssz + st rdi, ss, [1, t0, rsp], "8 * -env.stackSize", dataSize=ssz + subi rsp, rsp, "8 * env.stackSize" }; def macroop POPA { @@ -151,7 +156,8 @@ def macroop ENTER_I_I { # t1 is now the masked nesting level, and t2 is the amount of storage. # Push rbp. - stupd rbp, ss, [1, t0, rsp], "-env.dataSize" + st rbp, ss, [1, t0, rsp], "-env.dataSize" + subi rsp, rsp, ssz # Save the stack pointer for later mov t6, t6, rsp @@ -167,7 +173,8 @@ def macroop ENTER_I_I { limm t4, "ULL(-1)", dataSize=8 topOfLoop: ld t5, ss, [dsz, t4, rbp] - stupd t5, ss, [1, t0, rsp], "-env.dataSize" + st t5, ss, [1, t0, rsp], "-env.dataSize" + subi rsp, rsp, ssz # If we're not done yet, loop subi t4, t4, 1, dataSize=8 @@ -176,7 +183,8 @@ topOfLoop: bottomOfLoop: # Push the old rbp onto the stack - stupd t6, ss, [1, t0, rsp], "-env.dataSize" + st t6, ss, [1, t0, rsp], "-env.dataSize" + subi rsp, rsp, ssz skipLoop: sub rsp, rsp, t2, dataSize=ssz diff --git a/src/arch/x86/isa/insts/general_purpose/flags/push_and_pop.py b/src/arch/x86/isa/insts/general_purpose/flags/push_and_pop.py index 66d0062fc..0fb9d4f7e 100644 --- a/src/arch/x86/isa/insts/general_purpose/flags/push_and_pop.py +++ b/src/arch/x86/isa/insts/general_purpose/flags/push_and_pop.py @@ -40,7 +40,8 @@ def macroop PUSHF { .adjust_env oszIn64Override rflags t1 - stupd t1, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz + st t1, ss, [1, t0, rsp], "-env.stackSize", dataSize=ssz + subi rsp, rsp, ssz }; def macroop POPF { -- 2.30.2