From 25a6b1866e7c195c45c3d23f00937aa13bb2a2ff Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Tue, 23 Apr 2013 00:03:04 -0500 Subject: [PATCH] x86: increment the stack pointer in lret inst The 'lret' instruction reloads instruction pointer and code segment from the stack and then pops them. But the popping part is missing from the current implementation. This caused incorrect behavior in some code related to the Fiasco OS. Microops are being added to rectify the behavior of the instruction. Committed by: Nilay Vaish --- .../isa/insts/general_purpose/control_transfer/xreturn.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/arch/x86/isa/insts/general_purpose/control_transfer/xreturn.py b/src/arch/x86/isa/insts/general_purpose/control_transfer/xreturn.py index 6b21db851..7ebe22e78 100644 --- a/src/arch/x86/isa/insts/general_purpose/control_transfer/xreturn.py +++ b/src/arch/x86/isa/insts/general_purpose/control_transfer/xreturn.py @@ -69,6 +69,11 @@ def macroop RET_FAR { # Get the return CS ld t2, ss, [1, t0, rsp], ssz + # increment the stack pointer to pop the instruction pointer + # and the code segment from the stack. + addi rsp, rsp, dsz + addi rsp, rsp, dsz + # Get the rpl andi t3, t2, 0x3 -- 2.30.2