summaryrefslogtreecommitdiff
path: root/src/arch/x86/isa/insts/x87
diff options
context:
space:
mode:
authorAndreas Sandberg <andreas@sandberg.pp.se>2013-09-30 11:51:25 +0200
committerAndreas Sandberg <andreas@sandberg.pp.se>2013-09-30 11:51:25 +0200
commitc299dcedc6d73aab56d9c659623d7112c2e9c4bb (patch)
tree64aa1c869f4505bb8306da124fb081a23ae51167 /src/arch/x86/isa/insts/x87
parent469f2e31cfb5b50c52888684e47289921d42292a (diff)
downloadgem5-c299dcedc6d73aab56d9c659623d7112c2e9c4bb.tar.xz
x86: Fix re-entrancy problems in x87 store instructions
X87 store instructions typically loads and pops the top value of the stack and stores it in memory. The current implementation pops the stack at the same time as the floating point value is loaded to a temporary register. This will corrupt the state of the x87 stack if the store fails. This changeset introduces a pop87 micro-instruction that pops the stack and uses this instruction in the affected macro-instructions to pop the stack after storing the value to memory.
Diffstat (limited to 'src/arch/x86/isa/insts/x87')
-rw-r--r--src/arch/x86/isa/insts/x87/data_transfer_and_conversion/load_or_store_floating_point.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/arch/x86/isa/insts/x87/data_transfer_and_conversion/load_or_store_floating_point.py b/src/arch/x86/isa/insts/x87/data_transfer_and_conversion/load_or_store_floating_point.py
index 4e230513c..5a19aabd9 100644
--- a/src/arch/x86/isa/insts/x87/data_transfer_and_conversion/load_or_store_floating_point.py
+++ b/src/arch/x86/isa/insts/x87/data_transfer_and_conversion/load_or_store_floating_point.py
@@ -69,13 +69,15 @@ def macroop FSTP_R {
};
def macroop FSTP_M {
- movfp ufp1, st(0), spm=1
+ movfp ufp1, st(0)
stfp ufp1, seg, sib, disp
+ pop87
};
def macroop FSTP_P {
- movfp ufp1, st(0), spm=1
+ movfp ufp1, st(0)
rdip t7
stfp ufp1, seg, riprel, disp
+ pop87
};
'''