arch-x86: Implement real mode far ret.
Change-Id: I4fd3210f30246f19ca03906465f160bcbfbfbccc Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/55450 Reviewed-by: Gabe Black <gabe.black@gmail.com> Maintainer: Gabe Black <gabe.black@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -62,6 +62,29 @@ def macroop RET_NEAR_I
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user