Gabe Black has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/55449 )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the
submitted one.
)Change subject: arch-x86: Split out and implement INT for real mode.
......................................................................
arch-x86: Split out and implement INT for real mode.
The INT instruction is much simpler in real mode than it is in legacy
protected mode.
Change-Id: I79f5bc7ebe36726537cd61657f301905085c1199
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55449
Reviewed-by: Gabe Black <gabe.bl...@gmail.com>
Maintainer: Gabe Black <gabe.bl...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M
src/arch/x86/isa/insts/general_purpose/control_transfer/interrupts_and_exceptions.py
M src/arch/x86/isa/decoder/one_byte_opcodes.isa
2 files changed, 79 insertions(+), 6 deletions(-)
Approvals:
Gabe Black: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/arch/x86/isa/decoder/one_byte_opcodes.isa
b/src/arch/x86/isa/decoder/one_byte_opcodes.isa
index e34b477..66cb2c3 100644
--- a/src/arch/x86/isa/decoder/one_byte_opcodes.isa
+++ b/src/arch/x86/isa/decoder/one_byte_opcodes.isa
@@ -403,7 +403,13 @@
}});
}
- default: Inst::INT(Ib);
+ default: decode MODE_MODE {
+ 0x0: Inst::INT_LONG(Ib);
+ 0x1: decode MODE_SUBMODE {
+ 0x4: Inst::INT_REAL(Ib);
+ default: Inst::INT_PROT(Ib);
+ }
+ }
}
0x6: decode MODE_SUBMODE {
0x0: Inst::UD2();
diff --git
a/src/arch/x86/isa/insts/general_purpose/control_transfer/interrupts_and_exceptions.py
b/src/arch/x86/isa/insts/general_purpose/control_transfer/interrupts_and_exceptions.py
index 2b0c5cb..983d95e 100644
---
a/src/arch/x86/isa/insts/general_purpose/control_transfer/interrupts_and_exceptions.py
+++
b/src/arch/x86/isa/insts/general_purpose/control_transfer/interrupts_and_exceptions.py
@@ -263,8 +263,7 @@
br rom_label("legacyModeInterrupt")
};
-def macroop INT_I {
-
+def macroop INT_LONG_I {
#load the byte-sized interrupt vector specified in the instruction
.adjust_imm trimImm(8)
limm t1, imm, dataSize=8
@@ -272,11 +271,63 @@
rdip t7
# Are we in long mode?
- rdm5reg t5
- andi t0, t5, 0x1, flags=(EZF,)
- br rom_label("longModeSoftInterrupt"), flags=(CEZF,)
+ br rom_label("longModeSoftInterrupt")
+};
+
+def macroop INT_PROT_I {
+ #load the byte-sized interrupt vector specified in the instruction
+ .adjust_imm trimImm(8)
+ limm t1, imm, dataSize=8
+
+ rdip t7
+
+ # Are we in long mode?
br rom_label("legacyModeInterrupt")
};
+
+def macroop INT_REAL_I {
+ #load the byte-sized interrupt vector specified in the instruction
+ .adjust_imm trimImm(8)
+ limm t1, imm, dataSize=8
+
+ # temp_RIP
+ ld t2, idtr, [4, t1, t0], dataSize=2, addressSize=8
+ # temp_CS
+ ld t3, idtr, [4, t1, t0], 2, dataSize=2, addressSize=8
+
+ cda ss, [1, t0, rsp], -2, dataSize=2, addressSize=ssz
+ cda ss, [1, t0, rsp], -6, dataSize=2, addressSize=ssz
+
+ rflags t4, dataSize=8
+ rdsel t5, cs, dataSize=8
+ rdip t6
+
+ # Push RFLAGS.
+ st t4, ss, [1, t0, rsp], -2, dataSize=2, addressSize=ssz
+ # Push CS.
+ st t5, ss, [1, t0, rsp], -4, dataSize=2, addressSize=ssz
+ # Push the next RIP.
+ st t6, ss, [1, t0, rsp], -6, dataSize=2, addressSize=ssz
+
+ # Update RSP
+ subi rsp, rsp, 6, dataSize=ssz
+
+ # Set the CS selector.
+ wrsel cs, t3, dataSize=2
+ # Make sure there isn't any junk in the upper bits of the base.
+ mov t3, t0, t3
+ # Compute and set CS base.
+ slli t3, t3, 4, dataSize=8
+ wrbase cs, t3, dataSize=8
+
+ # If AC, TF, IF or RF are set, we want to flip them.
+ limm t7, "(ACBit | TFBit | IFBit | RFBit)", dataSize=8
+ and t7, t4, t7, dataSize=8
+ wrflags t4, t7, dataSize=8
+
+ # Set the new RIP
+ wrip t2, t0
+};
'''
#let {{
# class INT(Inst):
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/55449
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: I79f5bc7ebe36726537cd61657f301905085c1199
Gerrit-Change-Number: 55449
Gerrit-PatchSet: 5
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-CC: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-MessageType: merged
_______________________________________________
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