Review Board 2.0.15


x86: Fix implicit stack addressing in 64-bit mode

Review Request #3793 - Created Jan. 26, 2017 and submitted

Information
Jason Lowe-Power
gem5
default
Reviewers
Default

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

Runs "hello" compiled with gcc version "gcc (GCC) 6.3.1 20170109". Also runs hello compiled with earlier gcc in test-progs, and hello32 from test-progs.
Currently testing Linux boot.

Testing done on arch docker image. See https://hub.docker.com/r/powerjg/arch-dev/.
Run "docker run -v pwd:/gem5/ -it powerjg/arch-dev /bin/bash" to build/run/test gem5.

Issue Summary

2 0 2 0
Review request changed
Updated (Feb. 11, 2017, 8:54 a.m.)

Status: Closed (submitted)