Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/55250 )

Change subject: arch-x86: Use the stack size consistently for pushing for near calls.
......................................................................

arch-x86: Use the stack size consistently for pushing for near calls.

The near call instruction first attempts to store the return address on
the stack (the part of the instruction that could fail), and then if
that succeeds it decrements the stack pointer to point at the newly
stored data.

Unfortunately, the microcode was not using the same offset between those
two steps. Specifically it was using the effective operand size (which
is extremely common) when storing the return address which is incorrect,
but then using the effective stack size when adjusting the stack
pointer.

This change updates the microcode to use the effective stack size in
both places.

Change-Id: Ic4211a96900fee5d10c2fa0e038070383fefaac3
---
M src/arch/x86/isa/insts/general_purpose/control_transfer/call.py
1 file changed, 27 insertions(+), 4 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 4204a8c..4f68ee0 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,7 @@
     limm t1, imm
     rdip t7
     # Check target of call
-    stis t7, ss, [0, t0, rsp], "-env.dataSize"
+    stis t7, ss, [0, t0, rsp], "-env.stackSize"
     subi rsp, rsp, ssz
     wrip t7, t1
 };
@@ -58,7 +58,7 @@

     rdip t1
     # Check target of call
-    stis t1, ss, [0, t0, rsp], "-env.dataSize"
+    stis t1, ss, [0, t0, rsp], "-env.stackSize"
     subi rsp, rsp, ssz
     wripi reg, 0
 };
@@ -73,7 +73,7 @@
     rdip t7
     ld t1, seg, sib, disp
     # Check target of call
-    st t7, ss, [0, t0, rsp], "-env.dataSize"
+    st t7, ss, [0, t0, rsp], "-env.stackSize"
     subi rsp, rsp, ssz
     wripi t1, 0
 };
@@ -88,7 +88,7 @@
     rdip t7
     ld t1, seg, riprel, disp
     # Check target of call
-    st t7, ss, [0, t0, rsp], "-env.dataSize"
+    st t7, ss, [0, t0, rsp], "-env.stackSize"
     subi rsp, rsp, ssz
     wripi t1, 0
 };

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/55250
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ic4211a96900fee5d10c2fa0e038070383fefaac3
Gerrit-Change-Number: 55250
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to