Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/55450 )
Change subject: arch-x86: Implement real mode far ret.
......................................................................
arch-x86: Implement real mode far ret.
Change-Id: I4fd3210f30246f19ca03906465f160bcbfbfbccc
---
M src/arch/x86/isa/decoder/one_byte_opcodes.isa
M src/arch/x86/isa/insts/general_purpose/control_transfer/xreturn.py
2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/src/arch/x86/isa/decoder/one_byte_opcodes.isa
b/src/arch/x86/isa/decoder/one_byte_opcodes.isa
index 66cb2c3..d129f20 100644
--- a/src/arch/x86/isa/decoder/one_byte_opcodes.isa
+++ b/src/arch/x86/isa/decoder/one_byte_opcodes.isa
@@ -388,7 +388,7 @@
0x1: Inst::LEAVE();
0x2: ret_far_Iw();
0x3: decode MODE_SUBMODE {
- 0x3, 0x4: ret_far_real();
+ 0x3, 0x4: Inst::RET_FAR_REAL();
default: Inst::RET_FAR();
}
0x4: Inst::INT3();
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 8d32ea8..fea9448 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
@@ -62,6 +62,29 @@
wripi t1, 0
};
+def macroop RET_FAR_REAL {
+ .function_return
+ .control_indirect
+
+ # Pop the return RIP.
+ ld t1, ss, [1, t0, rsp], addressSize=ssz
+ # Pop the return CS.
+ ld t2, ss, [1, t0, rsp], dsz, addressSize=ssz
+ # Adjust RSP.
+ addi rsp, rsp, "2 * env.dataSize", dataSize=ssz
+
+ # Set the CS selector.
+ wrsel cs, t2
+ # Make sure there isn't any junk in the upper bits of the base.
+ mov t2, t0, t2
+ # Compute and set CS base.
+ slli t2, t2, 4, dataSize=8
+ wrbase cs, t2, dataSize=8
+
+ # Set the new RIP.
+ wrip t1, t0
+};
+
def macroop RET_FAR {
.adjust_env oszIn64Override
.function_return
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/55450
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: I4fd3210f30246f19ca03906465f160bcbfbfbccc
Gerrit-Change-Number: 55450
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s