diff options
author | Jason Lowe-Power <jason@lowepower.com> | 2017-02-10 11:19:34 -0500 |
---|---|---|
committer | Jason Lowe-Power <jason@lowepower.com> | 2017-02-10 11:19:34 -0500 |
commit | 153e5879c606c5d42ad9f2059488f67d8685a5d1 (patch) | |
tree | 80ab796da9bd7341191eff8739587e6db189284b /src/arch/x86/isa/insts/general_purpose/control_transfer | |
parent | 87b9f0b87b748fb8db87e2ff81d74bb76ec4769b (diff) | |
download | gem5-153e5879c606c5d42ad9f2059488f67d8685a5d1.tar.xz |
x86: Fix implicit stack addressing in 64-bit mode
When in 64-bit mode, if the stack is accessed implicitly by an instruction
the alternate address prefix should be ignored if present.
This patch adds an extra flag to the ldstop which signifies when the
address override should be ignored. Then, for all of the affected
instructions, this patch adds two options to the ld and st opcode to use
the current stack addressing mode for all addresses and to ignore the
AddressSizeFlagBit. Finally, this patch updates the x86 TLB to not
truncate the address if it is in 64-bit mode and the IgnoreAddrSizeFlagBit
is set.
This fixes a problem when calling __libc_start_main with a binary that is
linked with a recent version of ld. This version of ld uses the address
override prefix (0x67) on the call instruction instead of a nop.
Note: This has not been tested in compatibility mode and only the call
instruction with the address override prefix has been tested.
See [1] page 9 (pdf page 45)
For instructions that are affected see [1] page 519 (pdf page 555).
[1] http://support.amd.com/TechDocs/24594.pdf
Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/arch/x86/isa/insts/general_purpose/control_transfer')
-rw-r--r-- | src/arch/x86/isa/insts/general_purpose/control_transfer/call.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/arch/x86/isa/insts/general_purpose/control_transfer/call.py b/src/arch/x86/isa/insts/general_purpose/control_transfer/call.py index eaaa18208..c58152ca4 100644 --- a/src/arch/x86/isa/insts/general_purpose/control_transfer/call.py +++ b/src/arch/x86/isa/insts/general_purpose/control_transfer/call.py @@ -45,7 +45,7 @@ def macroop CALL_NEAR_I limm t1, imm rdip t7 # Check target of call - st t7, ss, [0, t0, rsp], "-env.dataSize" + stis t7, ss, [0, t0, rsp], "-env.dataSize" subi rsp, rsp, ssz wrip t7, t1 }; @@ -58,7 +58,7 @@ def macroop CALL_NEAR_R rdip t1 # Check target of call - st t1, ss, [0, t0, rsp], "-env.dataSize" + stis t1, ss, [0, t0, rsp], "-env.dataSize" subi rsp, rsp, ssz wripi reg, 0 }; |