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

Change subject: arch-x86: Implement popping into a stack selector in real mode.
......................................................................

arch-x86: Implement popping into a stack selector in real mode.

Segmentation is relatively easy to deal with in real mode, vs. protected
mode.

Change-Id: I4b93a7e321d5debb7240b002bb42fdecaafbfdfe
---
M src/arch/x86/isa/decoder/two_byte_opcodes.isa
M src/arch/x86/isa/decoder/one_byte_opcodes.isa
M src/arch/x86/isa/insts/general_purpose/data_transfer/stack_operations.py
3 files changed, 32 insertions(+), 2 deletions(-)



diff --git a/src/arch/x86/isa/decoder/one_byte_opcodes.isa b/src/arch/x86/isa/decoder/one_byte_opcodes.isa
index c47a9a3..e369621 100644
--- a/src/arch/x86/isa/decoder/one_byte_opcodes.isa
+++ b/src/arch/x86/isa/decoder/one_byte_opcodes.isa
@@ -47,6 +47,7 @@
             }
             0x7: decode MODE_SUBMODE {
                 0x0: UD2();
+                0x4: POP_REAL(sEv);
                 default: WarnUnimpl::pop_ES();
             }
             default: MultiInst::ADD(OPCODE_OP_BOTTOM3,
@@ -74,6 +75,7 @@
             }
             0x7: decode MODE_SUBMODE {
                 0x0: UD2();
+                0x4: POP_REAL(sSv);
                 default: WarnUnimpl::pop_SS();
             }
             default: MultiInst::ADC(OPCODE_OP_BOTTOM3,
@@ -88,6 +90,7 @@
             }
             0x7: decode MODE_SUBMODE {
                 0x0: UD2();
+                0x4: POP_REAL(sDv);
                 default: WarnUnimpl::pop_DS();
             }
             default: MultiInst::SBB(OPCODE_OP_BOTTOM3,
diff --git a/src/arch/x86/isa/decoder/two_byte_opcodes.isa b/src/arch/x86/isa/decoder/two_byte_opcodes.isa
index 1a37c0a..43f1eb3 100644
--- a/src/arch/x86/isa/decoder/two_byte_opcodes.isa
+++ b/src/arch/x86/isa/decoder/two_byte_opcodes.isa
@@ -668,7 +668,10 @@
         }
         0x14: decode OPCODE_OP_BOTTOM3 {
             0x0: Inst::PUSH(sFv);
-            0x1: pop_fs();
+            0x1: decode MODE_SUBMODE {
+                0x4: Inst::POP_REAL(sFv);
+                default: pop_fs();
+            }
             0x2: CPUIDInst::CPUID({{
                 CpuidResult result;
                 bool success = doCpuid(xc->tcBase(), bits(Rax, 31, 0),
@@ -695,7 +698,10 @@
         }
         0x15: decode OPCODE_OP_BOTTOM3 {
             0x0: Inst::PUSH(sGv);
-            0x1: pop_gs();
+            0x1: decode MODE_SUBMODE {
+                0x4: Inst::POP_REAL(sGv);
+                default: pop_gs();
+            }
             0x2: rsm_smm();
             0x3: Inst::BTS(Ev,Gv);
             0x4: Inst::SHRD(Ev,Gv,Ib);
diff --git a/src/arch/x86/isa/insts/general_purpose/data_transfer/stack_operations.py b/src/arch/x86/isa/insts/general_purpose/data_transfer/stack_operations.py
index 350b57e..e97d17f 100644
--- a/src/arch/x86/isa/insts/general_purpose/data_transfer/stack_operations.py +++ b/src/arch/x86/isa/insts/general_purpose/data_transfer/stack_operations.py
@@ -64,6 +64,15 @@
     st t1, seg, riprel, disp
 };

+def macroop POP_REAL_S {
+    ld t1, ss, [1, t0, rsp], addressSize=ssz, dataSize=2
+    addi rsp, rsp, dsz, dataSize=ssz
+    wrsel sr, t1
+    mov t1, t0, t1, dataSize=2
+    slli t1, t1, 4, dataSize=8
+    wrbase sr, t1, dataSize=8
+};
+
 def macroop PUSH_R {
     # Make the default data size of pops 64 bits in 64 bit mode
     .adjust_env oszIn64Override

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/55590
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: I4b93a7e321d5debb7240b002bb42fdecaafbfdfe
Gerrit-Change-Number: 55590
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

Reply via email to