diff options
author | Andreas Sandberg <andreas@sandberg.pp.se> | 2013-06-18 16:36:08 +0200 |
---|---|---|
committer | Andreas Sandberg <andreas@sandberg.pp.se> | 2013-06-18 16:36:08 +0200 |
commit | d06064c38613662dfbf68a701052278b4018de8c (patch) | |
tree | cc7870da633caf1c52abbd624c37754fe5a99b52 /src/arch/x86/utility.hh | |
parent | a8e8c4f433fb3cce354950ba72136b84abb78015 (diff) | |
download | gem5-d06064c38613662dfbf68a701052278b4018de8c.tar.xz |
x86: Add support for maintaining the x87 tag word
The current implementation of the x87 never updates the x87 tag
word. This is currently not a big issue since the simulated x87 never
checks for stack overflows, however this becomes an issue when
switching between a virtualized CPU and a simulated CPU. This
changeset adds support, which is enabled by default, for updating the
tag register to every floating point microop that updates the stack
top using the spm mechanism.
The new tag words is generated by the helper function
X86ISA::genX87Tags(). This function is currently limited to flagging a
stack position as valid or invalid and does not try to distinguish
between the valid, zero, and special states.
Diffstat (limited to 'src/arch/x86/utility.hh')
-rw-r--r-- | src/arch/x86/utility.hh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/arch/x86/utility.hh b/src/arch/x86/utility.hh index 48840ac77..24aca3e0a 100644 --- a/src/arch/x86/utility.hh +++ b/src/arch/x86/utility.hh @@ -141,6 +141,21 @@ namespace X86ISA inline uint64_t getDoubleBits(double val) { return *(uint64_t *)(&val); } + + /** + * Generate and updated x87 tag register after a push/pop + * operation. + * + * @note There is currently no support for setting other tags than + * valid and invalid. A real x87 will set the tag value to zero or + * special for some special floating point values. + * + * @param ftw Current value of the FTW register. + * @param top Current x87 TOP value. + * @param spm Stack displacement. + * @return New value of the FTW register. + */ + uint16_t genX87Tags(uint16_t ftw, uint8_t top, int8_t spm); } #endif // __ARCH_X86_UTILITY_HH__ |