summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2007-07-29 01:26:47 -0700
committerGabe Black <gblack@eecs.umich.edu>2007-07-29 01:26:47 -0700
commitd99557534217dc59e33ca70591b52d9d9e8322a8 (patch)
tree671e66e204e9b63986485a7f67ac78dc991ffa12
parent3dcd848ec340e96f374ee9859bf4f8906fb577cc (diff)
downloadgem5-d99557534217dc59e33ca70591b52d9d9e8322a8.tar.xz
X86: Fix popa and push with the stack pointer.
POPA used st instead of ld, and it didn't skip rsp. push rsp needs to store the -original- value of the stack pointer. --HG-- extra : convert_revision : 376370c99b6ab60fb2bc4cd4f0a6dce71153ad06
-rw-r--r--src/arch/x86/isa/insts/data_transfer/stack_operations.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/arch/x86/isa/insts/data_transfer/stack_operations.py b/src/arch/x86/isa/insts/data_transfer/stack_operations.py
index 889e7b88b..1c13b44b4 100644
--- a/src/arch/x86/isa/insts/data_transfer/stack_operations.py
+++ b/src/arch/x86/isa/insts/data_transfer/stack_operations.py
@@ -85,8 +85,10 @@ def macroop PUSH_R {
# Make the default data size of pops 64 bits in 64 bit mode
.adjust_env oszIn64Override
+ # This needs to work slightly differently from the other versions of push
+ # because the -original- version of the stack pointer is what gets pushed
+ st reg, ss, [0, t0, rsp], "-env.dataSize"
subi rsp, rsp, dsz
- st reg, ss, [0, t0, rsp]
};
def macroop PUSH_I {
@@ -130,14 +132,13 @@ def macroop PUSHA {
};
def macroop POPA {
- st rdi, ss, [0, t0, rsp], "0 * env.dataSize"
- st rsi, ss, [0, t0, rsp], "1 * env.dataSize"
- st rbp, ss, [0, t0, rsp], "2 * env.dataSize"
- st rsp, ss, [0, t0, rsp], "3 * env.dataSize"
- st rbx, ss, [0, t0, rsp], "4 * env.dataSize"
- st rdx, ss, [0, t0, rsp], "5 * env.dataSize"
- st rcx, ss, [0, t0, rsp], "6 * env.dataSize"
- st rax, ss, [0, t0, rsp], "7 * env.dataSize"
+ ld rdi, ss, [0, t0, rsp], "0 * env.dataSize"
+ ld rsi, ss, [0, t0, rsp], "1 * env.dataSize"
+ ld rbp, ss, [0, t0, rsp], "2 * env.dataSize"
+ ld rbx, ss, [0, t0, rsp], "4 * env.dataSize"
+ ld rdx, ss, [0, t0, rsp], "5 * env.dataSize"
+ ld rcx, ss, [0, t0, rsp], "6 * env.dataSize"
+ ld rax, ss, [0, t0, rsp], "7 * env.dataSize"
addi rsp, rsp, "8 * env.dataSize"
};
'''